Skip to main content

Home > @rushstack/node-core-library > Enum > getValueByKey

Enum.getValueByKey() method

This API is similar to Enum.tryGetValueByKey() , except that it throws an exception if the key is undefined.

Signature:
static getValueByKey<TEnumValue>(enumObject: {
[key: string]: TEnumValue | string;
[key: number]: TEnumValue | string;
}, key: string): TEnumValue;

Parameters

ParameterTypeDescription
enumObject{ [key: string]: TEnumValue | string; [key: number]: TEnumValue | string; }
keystring
Returns:

TEnumValue