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

Parameter Type Description
enumObject { [key: string]: TEnumValue | string; [key: number]: TEnumValue | string; }  
key string  

Returns:

TEnumValue