Runtime type system for IO decoding/encoding
FunctionType
, FunctionC
, Function
NeverType
, NeverC
, never
AnyType
, AnyC
, any
RefinementC
, refinement
, Integer
Error
to be decoded with UnknownRecord
, #664 (@mlegenhausen)[email protected]
errors, closes #656, closes #647 (@gcanti)Experimental modules require fp-ts@^2.5.0
.
Codec
readonly
combinator (@gcanti)Encoder
readonly
combinator (@gcanti)Schemable
readonly
combinator (@gcanti)struct
combinator (@gcanti)type
in favour of struct
(@gcanti)fromType
in favour of fromStruct
(@gcanti)(*) breaking change
Guard
UnknownRecord
check, closes #559 (@waynevanson)mergeAll
function, closes #532 (@gcanti)sum
safer, closes #523 (@gcanti)(*) breaking change
In case of non-string
tag values, the respective key must be enclosed in brackets
export const MySum: D.Decoder<
unknown,
| {
type: 1 // non-`string` tag value
a: string
}
| {
type: 2 // non-`string` tag value
b: number
}
> = D.sum('type')({
[1]: D.type({ type: D.literal(1), a: D.string }),
[2]: D.type({ type: D.literal(2), b: D.number })
})
Decoder
toForest
stack-safe, #520 (@safareli)