typelab / utils / ParseBigIntNegative
type ParseBigIntNegative<T> = ParseBigInt<T> extends infer Bigi ? Bigi extends 0n ? 0n : Bigi extends bigint ? IsNegative<Bigi> extends true ? Bigi : `-${Bigi}` extends `${infer Result extends bigint}` ? Result : never : never : never;Parses a string or number type into a negative bigint.
| Type Parameter | Description |
|---|---|
|
|
The type to parse. |
The parsed negative bigint type.
type Bigi = ParseBigIntNegative<'11'>; // -11n