aboutsummaryrefslogtreecommitdiff
path: root/stdlib/nat.ts
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2023-01-13 20:32:20 +0530
committerAkshay Nair <phenax5@gmail.com>2023-01-13 20:33:01 +0530
commit518a6a9ee31f0b03f08cb77bc613b4d708bb640b (patch)
tree7f17ce66f337dee573192ce06a24385415048ae2 /stdlib/nat.ts
parent42f8c401dc9519bc8b2d386ce9eda072144a46d0 (diff)
downloadts-types-lang-518a6a9ee31f0b03f08cb77bc613b4d708bb640b.tar.gz
ts-types-lang-518a6a9ee31f0b03f08cb77bc613b4d708bb640b.zip
chore: prettier
Diffstat (limited to 'stdlib/nat.ts')
-rw-r--r--stdlib/nat.ts19
1 files changed, 11 insertions, 8 deletions
diff --git a/stdlib/nat.ts b/stdlib/nat.ts
index 4334a30..52877c1 100644
--- a/stdlib/nat.ts
+++ b/stdlib/nat.ts
@@ -3,16 +3,19 @@ export type Zero = { _prev: null }
export type Succ<N extends Nat> = { _prev: N }
export type Pred<N extends Nat> = N extends Zero ? Zero : N['_prev']
-export type Add<A extends Nat, B extends Nat> =
- A extends Zero ? B : Add<Pred<A>, Succ<B>>
+export type Add<A extends Nat, B extends Nat> = A extends Zero
+ ? B
+ : Add<Pred<A>, Succ<B>>
-export type ToNumber<N extends Nat, Acc extends 0[] = []> =
- N extends Zero ? Acc['length']
- : ToNumber<Pred<N>, [...Acc, 0]>
+export type ToNumber<N extends Nat, Acc extends 0[] = []> = N extends Zero
+ ? Acc['length']
+ : ToNumber<Pred<N>, [...Acc, 0]>
-export type FromNumber<N extends number, Res extends Nat = Zero, Acc extends 0[] = []> =
- N extends Acc['length'] ? Res
- : FromNumber<N, Succ<Res>, [...Acc, 0]>
+export type FromNumber<
+ N extends number,
+ Res extends Nat = Zero,
+ Acc extends 0[] = []
+> = N extends Acc['length'] ? Res : FromNumber<N, Succ<Res>, [...Acc, 0]>
export type _0 = Zero
export type _1 = Succ<_0>