API reference › @evolu/common › Type › Int64String
const Int64String: brand(
"Int64String",
NonEmptyTrimmedString,
(value) => {
const negative = value.startsWith("-");
if (
value.length > (negative ? 20 : 19) ||
!/^(?:0|-?[1-9]\d*)$/u.test(value)
) {
return err<Int64StringError>({ type: "Int64String", value });
}
const digits = negative ? value.slice(1) : value;
const max = negative ? "9223372036854775808" : "9223372036854775807";
return digits.length < 19 || digits <= max
? ok()
: err<Int64StringError>({ type: "Int64String", value });
},
(error) =>
`The value ${safelyStringifyUnknownValue(error.value)} is not a valid Int64 string.`,
);
Defined in: packages/common/src/Type.ts:6206
Decimal string representation of a signed Int64.