/** * Strict number parser. No locale guessing, no normalization. * Non-canonical forms (leading zeros, trailing dots, etc.) are accepted — * formatting to canonical form happens on blur/enter in the component. * * Input/output table (covers ~90% of real cases): * * | Input | Result | Reason | * |---------------------|---------------------------------|---------------------------------| * | "" | {} | empty | * | "-" | {} | partial | apply blur/enter format * | "." | {} | partial | apply blur/enter format * | "-." | {} | partial | apply blur/enter format * | "123." | { value: 123 } | trailing dot | apply blur/enter format * | "1e" | { value: 1 } | partial exp → 1e+0 | apply blur/enter format * | "1e-" | { value: 1 } | partial exp → 1e-0 | apply blur/enter format * | "1e+" | { value: 1 } | partial exp → 1e+0 | apply blur/enter format * | "123" | { value: 123 } | exact match | * | "-5" | { value: -5 } | exact match | * | "0.5" | { value: 0.5 } | exact match | * | "0.0000000001" | { value: 1e-10 } | decimal form matches | * | "1e-5" | { value: 0.00001 } | exponential notation | apply blur/enter format * | "2e+10" | { value: 2e10 } | exponential notation | apply blur/enter format * | ".5" | { value: 0.5 } | not canonical | apply blur/enter format * | "01" | { value: 1 } | leading zero | apply blur/enter format * | "1.0" | { value: 1 } | trailing zero | apply blur/enter format * | "1.10" | { value: 1.1 } | trailing zero | apply blur/enter format * | "+5" | { value: 5 } | unnecessary plus | apply blur/enter format * | "1,5" | { error: "...separator..." } | comma instead of dot | * | "1.232,111" | { error: "...separator..." } | EU locale format | * | "1.237.62" | { error: "...separator..." } | multiple dots (EU thousands) | * | "555.555.555,100" | { error: "...separator..." } | EU locale format | * | "1,222,333.05" | { error: "...separator..." } | US locale format | * | "abc" | { error: "not a number" } | letters | * | "12abc" | { error: "not a number" } | letters mixed in | * | "1.237.asdf62" | { error: "not a number" } | letters mixed in | * | "9007199254740993" | { error: "precision..." } | integer exceeds safe range | * | "0.1234567890123456789" | { error: "precision..." } | too many digits for float64 | */ export type ParseResult = { value: number; error?: undefined; } | { value?: undefined; error: string; } | { value?: undefined; error?: undefined; }; export declare function tryParseNumber(str: string): ParseResult; /** * Converts a number to a plain decimal string (no exponential notation). * E.g. 1e-7 → "0.0000001", 2e+21 → "2000000000000000000000" */ export declare function numberToDecimalString(n: number | undefined): string; export declare function validateNumber(value: number, props: { minValue?: number; maxValue?: number; validate?: (v: number) => string | undefined; }): string | undefined; //# sourceMappingURL=parseNumber.d.ts.map