API reference › @evolu/common › Type › Int64FromInt64String
const Int64FromInt64String: transform(
"Int64FromInt64String",
Int64String,
Int64,
{
from: (value) => ok(globalThis.BigInt(value)),
to: (value) => globalThis.String(value) as Int64String,
},
);
Defined in: packages/common/src/Type.ts:6261
Transforms an Int64String into an Int64.
This is useful at boundaries that expose signed 64-bit integers as decimal text, including SQLite queries that cast INTEGER values to TEXT to avoid a lossy JavaScript number conversion.
Example
import { assertEqual, assertOk, Int64FromInt64String } from "@evolu/common";
const result = Int64FromInt64String.fromUnknown("9223372036854775807");
assertOk(result, 9223372036854775807n);
assertEqual(Int64FromInt64String.to(result.value), "9223372036854775807");