• Returns a new object with only the specified keys from the input object.

    Type Parameters

    • T extends {
          [key: string]: unknown;
      }

    • Keys extends string | number | symbol

    Parameters

    • obj: T

      The input object to pick keys from.

    • keys: Keys[]

      An array of keys to pick from the input object.

    Returns {
        [key in string | number | symbol]: T[key]
    }

    • A new object containing only the specified keys from the input object.

    Example

      pick({ a: 1, b: '2', c: true }, ['a', 'c']); // returns { a: 1, c: true }
    

Generated using TypeDoc