Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 3x | import type { EnumObject } from './enum-object';
import { getEnumEntries } from './get-enum-entries';
/**
* Lists the member names of an enum, without the reverse mapping of numeric enums.
*
* @template E - The type of the enum object.
* @param enumObject - The enum to read, such as `Direction`.
* @returns The member names, in declaration order.
* @example
* enum Direction { Up, Down }
* getEnumKeys(Direction); // ['Up', 'Down']
*/
export function getEnumKeys<E extends EnumObject>(enumObject: E): (keyof E & string)[] {
return getEnumEntries(enumObject).map(([key]) => key);
}
|