Created
November 3, 2022 08:20
-
-
Save hades2510/ce5ac9cda348aa4c1291287be8841f07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type PartialAddOne<T extends Bit[]> = T extends [ | |
...infer U extends Bit[], | |
infer R extends Bit | |
] | |
? R extends One | |
? [...PartialAddOne<U>, Zero] | |
: [...U, One] | |
: []; | |
type AddOne<T extends Byte> = T extends [ | |
...infer U extends Bit[], | |
infer R extends Bit | |
] | |
? R extends One | |
? [...PartialAddOne<U>, Zero] | |
: [...U, One] | |
: []; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment