News for hackers. Stuff that matters.
Re:TypeScript’s quirks: How inconsistencies make the languag... by alangpierce on Saturday February 01, 2020 @02:14AM (#22209192)
I solved this using the ts-interface-builder and ts-interface-checker libraries and have been happy with the result. You write a plain TS type (rather than a custom syntax like io-ts has) and then run a codegen step to make a runtime representation of the type. Then you can create a checker from that and do runtime type checking.

https://github.com/gristlabs/ts-interface-builder

https://github.com/gristlabs/ts-interface-checker

Example: https://github.com/alangpierce/sucrase/pull/468/files

There are no comments on this comment yet.