Skip to content

getEnumKey<T>

Get the key of an enum value.

Import:

import { getEnumKey } from '@mnaoumov/typescript-lib/enum';

Signature:

function getEnumKey(enumType: T, value: T[keyof T]): keyof T

Parameters:

Parameter Type Description
enumType T The enum type.
value T[keyof T] The value to get the key of.

Returns: keyof T — The key of the enum value.