Type Level Tricks in TypeScript

added by JavaScript Kicks
1/31/2019 8:02:56 AM

386 Views

TypeScript has a Turing complete type system. This means there are all sorts of compile time invariants that we can enforce with the type system that we couldn't otherwise. I haven't seen some of these patterns explicitly outlined elsewhere so I'm going to outline one trick that I've discovered while trying to encode various properties with TypeScript's type system.


0 comments