From b5b18e46e3a5c4daaa3b4613395b1a216a47bc17 Mon Sep 17 00:00:00 2001 From: braxtonhall Date: Sun, 23 Oct 2022 11:20:39 -0700 Subject: Initial commit --- entries/braxtonh/types/index.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 entries/braxtonh/types/index.ts (limited to 'entries/braxtonh/types/index.ts') diff --git a/entries/braxtonh/types/index.ts b/entries/braxtonh/types/index.ts new file mode 100644 index 0000000..11f4086 --- /dev/null +++ b/entries/braxtonh/types/index.ts @@ -0,0 +1,18 @@ +type Zero = "😰"; + +type Succ = {prev: N}; + +type Prev = N extends Succ ? P : never; + +type Add = B extends Zero ? A : Succ>>; + +type _Fib = + N extends Zero + ? AccumulatorA + : N extends Succ + ? AccumulatorB + : _Fib, AccumulatorB, Add>; + +type Fib = _Fib>; + +export type {Zero, Succ, Fib}; -- cgit v1.2.3-70-g09d2