object-shape-tester - v5.1.6
    Preparing search index...

    Function optional

    • Define a shape part that is optional. This only makes sense as a property in an object.

      Type Parameters

      • T

      Parameters

      • part: T

      Returns ShapeOptional<T>

      import {optional, defineShape} from 'object-shape-tester';

      const myShape = defineShape({
      a: optional(-1),
      });

      // `myShape.runtimeType` is `{a?: number}`