Typology is a playground for exploring type-level programming in TypeScript. The various types range from simple representations of natural numbers to types that can compute Fibonacci numbers.
const three: Add<Succ<Zero>, Succ<Succ<Zero>>> = {
n: {
n: {
n: "zero"
},
},
}
const six: Factorial<Three> = { n: { n: { n: { n: { n: { n: "zero" } } } } } }
const five: FromString<"{ n: { n: { n: { n: { n: zero } } } } }"> = {
n: { n: { n: { n: { n: "zero" } } } },
}
const two: IfElse<
And<
LessThan<Four, Six>,
Not<GreaterThan<Five, Ten>>
>,
ToString<Succ<Succ<Zero>>>,
never
> = "{ n: { n: zero } }"
const five: Fibonacci<Five> = { n: { n: { n: { n: { n: "zero" } } } } }
See LICENSE.