Skip to content

v1.2.0

Compare
Choose a tag to compare
@github-actions github-actions released this 30 Jan 15:46

Changelog: v1.1.1...v1.2.0

  1. deepPartial method was added for all object-like, composite, and proxy shapes.

  2. All built-in checks (aka constraints) are now always unsafe.

  3. 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
  1. BrandShape interface was added to preserve the deep partial protocol of the underlying shape.

  2. IncludeShape interface was added (an alias for ReplaceShape) that allows the same value as an input as an output.

  3. TypeConstraintOptions was removed in favor of ConstraintOptions.

  4. createIssueFactory export was removed.

  5. Opaque*Shape types were removed.