v8.4.0
Pre-release
Pre-release
TS API Features
Shorthand syntax for S.schema
const loginSchema = S.schema({
email: S.email(S.string),
password: S.stringMinLength(S.string, 8),
});It's going to replace S.object in V9.
Shorthand syntax for S.union
const shapeSchema = S.union([
{
kind: "circle" as const,
radius: S.number,
},
{
kind: "square" as const,
x: S.number,
},
{
kind: "triangle" as const,
x: S.number,
y: S.number,
},
]);Added function-based operation instead of method-based
- parseWith
- parseAsyncWith
- convertWith
- convertToJsonStringWith
- assertWith
They throw exceptions by default. You can use the S.safe and S.safeAsync to turn them into result objects.
Deprecations in favor of a new name
S.variant->S.toS.assertAnyWith->S.assertWith
Temporary Regressions/Breaking changes
S.to/S.variantdoesn't allow to destructure tuples anymores.flattenstopped working withS.schema
Reverse conversion (serializing) improvement
Now, it's possible to convert back to object schemas where a single field is used multiple times.
Bug Fix
Fix parsing of a tuple nested inside of an object schema.
Full Changelog: v8.3.0...v8.4.0