v1.2.0
Changelog: v1.1.1...v1.2.0
-
deepPartial
method was added for all object-like, composite, and proxy shapes. -
All built-in checks (aka constraints) are now always unsafe.
-
Derived shapes now inherit unsafe checks:
const shape1 = d.object({ foo: d.string() }).check(
value => {
if (value.foo !== undefined && value.foo.length > 2) {
return { code: 'kaputs' };
}
},
{ unsafe: true }
);
// 🟡 Checks of shape1 are potentially incompatible with shape2
const shape2 = shape1.deepPartial();
shape2.parse({});
// ⮕ {}
shape2.parse({ foo: 'aaa' });
// ❌ ValidationError: kaputs at /foo
-
BrandShape
interface was added to preserve the deep partial protocol of the underlying shape. -
IncludeShape
interface was added (an alias forReplaceShape
) that allows the same value as an input as an output. -
TypeConstraintOptions
was removed in favor ofConstraintOptions
. -
createIssueFactory
export was removed. -
Opaque*Shape
types were removed.