Function typedKeys

  • Typed version of Object.keys().

    Type Parameters

    • T extends object

    Parameters

    • obj: T

      The object whose enumerable own property names are to be returned.

    Returns (keyof T)[]

    An array of the given object's own enumerable property names.

    Example

    Basic Usage

    const obj = { a: 1, b: 2, c: 3 }
    const keys = typedKeys(obj) // type: ('a' | 'b' | 'c')[]
    console.log(keys) // ['a', 'b', 'c']

Generated using TypeDoc