Discover more from Matt Rickard
TypeScript Type System Hacks
TypeScript’s type system is Turing Complete. The type system is extremely advanced — you can model algebraic data types (unions, intersections, tuples), conditional types, mapped types, and more. It is a structural type system. In TS 4.1, template literal types were introduced, making it easy to do string manipulation within the type system so that you can concatenate, compare, and pattern-match the types. Many of the examples below (like TS-SQL) use template literal types.
Some interesting applications built in entirely in the TypeScript type system:
And some other accidentally Turing Complete systems.