© 2026 Hedgehog Software, LLC
import { type } from "arktype"; const Amount = type("string|number") .pipe((s, ctx) => { try { return BigInt(s); } catch { return ctx.error("a non-decimal number"); } }) .narrow((amount, ctx) => amount > 0n || ctx.mustBe("greater than zero")); console.log(Amount.assert("1000"));
ParseError: Root of kind union should be one of alias,intersection,unit,domain,proto