Function objectValues

  • Returns the values of an object as a strongly-typed array of values.

    Type Parameters

    • T extends object

    Parameters

    • obj: T

      The object whose values are to be extracted.

    Returns T[keyof T][]

    An array of values of the given object, typed as the values of the object.

    const person = { name: "Alice", age: 30 };
    const values = objectValues(person); // Type: [string, number]