Skip to content

Instantly share code, notes, and snippets.

View amerryma's full-sized avatar

Aaron Merryman amerryma

View GitHub Profile
@hediet
hediet / main.md
Last active December 13, 2024 15:40
Proof that TypeScript's Type System is Turing Complete
type StringBool = "true"|"false";


interface AnyNumber { prev?: any, isZero: StringBool };
interface PositiveNumber { prev: any, isZero: "false" };

type IsZero<TNumber extends AnyNumber> = TNumber["isZero"];
type Next<TNumber extends AnyNumber> = { prev: TNumber, isZero: "false" };
type Prev<TNumber extends PositiveNumber> = TNumber["prev"];