@byte.london/deptypeguards
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

BYTE/DEPT® TypeGuards

(AKA ByteGuards)

This is a library for having typeguards at runtime boundaries, in addition to the native TS compile time checking. The purpose of this is to provide more information when variables fail type-guards, but also to ensure that when data comes back from an API, DB call etc, that it is of the type that we expect. This adds some overhead at run-time, but with the benefit of providing complete type security.

We have found it to be superior to other libraries such as io-ts and Spicery, and ts-runtime which runs in Babel, as there is a clearer indicator of what is going on, as well as verbose messages if you want them. In addition, with the use of GitHub CoPilot, we have found the 'manual' generation of TypeGuards quick and easy.

It was inspired by this article, written back in 2018.

License

Distributed under the MIT License. See LICENSE.txt for more information.

Readme

Keywords

none

Package Sidebar

Install

npm i @byte.london/deptypeguards

Weekly Downloads

2

Version

1.0.3

License

ISC

Unpacked Size

114 kB

Total Files

31

Last publish

Collaborators

  • riskycodes