io-ts
io-ts copied to clipboard
`PathReporter` throws when a `bigint` is part of the error messages
https://github.com/gcanti/io-ts/blob/920b21ea32e82b328cd14ff4b28da72ae60db505/src/PathReporter.ts#L18
This will throw an error when a bigint is involved. Could we use a replacer in this call to handle bigint?
@jonball4 could you please provide a repro?
@gcanti @jonball4 could you please provide a repro?
interface PositiveBigIntBrand {
readonly PositiveBigInt: unique symbol
}
const PositiveBigInt = t.brand(
t.bigint,
(n): n is t.Branded<bigint, PositiveBigIntBrand> => BigInt(0) < n,
'PositiveBigInt',
)
const testC = t.type({ value: PositiveBigInt });
const testValidation = testC.decode({ value: -10n });
// This will throw
const value = PathReporter.report(testValidation);