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

    Function intersectShape

    • Creates a shape that merges multiple objects together.

      Type Parameters

      • T extends readonly [object, object]

      Parameters

      • ...inits: T

      Returns Shape<TUnsafe<UnionToIntersection<ShapeInitType<ArrayElement<T>>>>>

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

      const myShape = intersectShape(
      {
      a: '',
      },
      {
      b: '',
      },
      );

      checkValidShape({a: 'hi', b: 'bye'}, myShape); // `true`
      checkValidShape({a: 'hi'}, myShape); // `false`