object-shape-tester - v6.9.2
    Preparing search index...

    Function partialShape

    • Converts an object shape to a partial shape.

      Type Parameters

      • T

      Parameters

      • init: T

      Returns Shape<TPartial<ShapeInitSchema<T>>>

      import {partialShape, checkValidShape} from 'object-shape-tester';

      const myShape = partialShape({
      id: '',
      name: '',
      age: -1,
      });

      checkValidShape({}, myShape); // `true`
      checkValidShape(
      {
      id: '123',
      name: 'hello',
      },
      myShape,
      ); // `true`
      checkValidShape(
      {
      invalid: 'prop',
      },
      myShape,
      ); // `false`