Unit testing for TypeScript types

While working with @migueldar on an update to ts-predicates we thought that it would be cool to have a library for testing TypeScript types. Something that we could use in regular unit tests and would report whether or not certain snippets of TS do or do not throw typecheck errors. It’s important as in Sealious, Sealgen, and ts-predicates all take great care to have advanced type rules. Unit testing those type rules would make it easier to add new features to those libraries with less fear about regressions.

I’ve summarized the gist of what this new library can be in T2701.

However, maybe something like this already exists? I’ve searched online and came back empty-handed. If any of you have more luck, please do let me know, it would save us some effort implementing this from scratch :smiley:

1 Like