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

    Function indexedKeys

    • Define a shape part that's an object with a specific set of keys and values.

      Type Parameters

      Parameters

      Returns ShapeIndexedKeys<Parts>

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

      const myShape = defineShape({
      a: indexedKeys({
      keys: or(exact('hi'), exact('bye')),
      values: {
      helloThere: 0,
      },
      required: false,
      }),
      });

      // `myShape.runtimeType` is `{a: Partial<Record<'hi' | 'bye', {helloThere: number}>>}`