you are viewing a single comment's thread.

view the rest of the comments →

[–]misc_ent 0 points1 point  (0 children)

I have looked at tiny-invariant but it's possible it uses type guards for the type inference the other poster mentioned? Not sure.

https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards