import { ArkErrors, type } from "arktype";
const ToBigInt = type("string").pipe((v) => BigInt(v));
const MyType = type({
a: ToBigInt,
b: "number"
});
// type MyType = typeof MyType.out;
// Results in:
// type MyType = Type<{
// a: unknown;
// b: number;
// }, {}>
type MyType = Exclude<ReturnType<typeof MyType>, ArkErrors>;
// Is correct:
// type MyType = {
// a: bigint;
// b: number;
// }
import { ArkErrors, type } from "arktype";
const ToBigInt = type("string").pipe((v) => BigInt(v));
const MyType = type({
a: ToBigInt,
b: "number"
});
// type MyType = typeof MyType.out;
// Results in:
// type MyType = Type<{
// a: unknown;
// b: number;
// }, {}>
type MyType = Exclude<ReturnType<typeof MyType>, ArkErrors>;
// Is correct:
// type MyType = {
// a: bigint;
// b: number;
// }