type ArrayOwnKeys = Exclude; type ArrayOwnStringKeys = Extract, string | number>; type ArrayEntryValue = number extends Type['length'] ? Type[number] | Type[ArrayOwnStringKeys] : Type[ArrayOwnStringKeys]; /** A strongly-typed version of `Object.values()`. This is useful since `Object.values()` always returns `T[]`. This function returns a strongly-typed array of the values of the given object. - [TypeScript issues about this](https://github.com/microsoft/TypeScript/pull/12253) @example ``` import {objectValues} from 'ts-extras'; const object: {a: number; b?: string} = {a: 1, b: 'hello'}; const stronglyTypedValues = objectValues(object); //=> Array const untypedValues = Object.values(object); //=> Array ``` @category Improved builtin */ // eslint-disable-next-line @typescript-eslint/no-restricted-types -- We intentionally use `object` to accept interfaces. // Intentionally unsafe cast to provide strongly-typed Object.values(). export const objectValues = Object.values as { (value: Type): Array>; (value: Type): Array[Extract]>; };