|
|
|
|
|
by nkrisc
1154 days ago
|
|
I learned more from this type definition than anything I’ve ever read about TypeScript’s type system before: interface add extends F { out: this['args'] extends [infer a, infer b] ?
a extends Zero ? b :
a extends Suc<infer n> ? Suc<apply<add, [n, b]>> :
never : never
}
|
|