import type { Args, Fn } from "../HKT"; import type { SDigit } from "../Num"; import type { AssertBool } from "../helpers"; /** * Check if a string is a digit (i.e. 0-9). * * Sig: `(s: string) => boolean` */ export type IsDigit = AssertBool< string extends S ? boolean : S extends `${infer C}` ? C extends SDigit ? true : false : false >; /** * [Fn] Check if a string is a digit (i.e. 0-9). * * Sig: `(s: string) => boolean` */ export default interface IsDigitFn extends Fn<[string], boolean> { def: ([s]: Args) => IsDigit; }