Type Alias StringToNumber<S, Fail>
StringToNumber<S, Fail>: S extends "-0" ? 0 : S extends `${infer W}.0` ? StringToNumber<W> : S extends `${infer W}.${infer F}0` ? StringToNumber<`${W}.${F}`> : S extends `${infer N extends number}` ? N : Fail Type Parameters
- S extends string
- Fail = never
Cast a string to a number literal type if possible.