import type { Int } from "."; import type { ParsingError } from "../../Error"; import type { Args, Call1, Fn } from "../../HKT"; import type { Every } from "../../List/Every"; import type { Err, Ok, Result } from "../../Result"; import type IsDigitFn from "../../Str/IsDigit"; import type { Str$$Show } from "../../Str/Show"; import type { ToChars } from "../../Str/ToChars"; import type { Assert } from "../../helpers"; import type { Abs } from "../Abs"; /** * Parse a string to an {@link Int}. * * Sig: `(s: string) => Result` */ export type FromStr = Assert< Result, string extends S ? Result : S extends `${infer N extends number}` ? Every}`>> extends true ? Ok : Err} is not a valid integer`>> : Err} is not a valid integer`>> >; /** * [Fn] Parse a string to an {@link Int}. * * Sig: `(s: string) => Result` */ export default interface FromStrFn extends Fn<[string], Result> { def: ([s]: Args) => FromStr; }