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

Enum.getKeyByNumber() method

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

Signature:

static getKeyByNumber<TEnumValue, TEnumObject extends {
        [key: string]: TEnumValue;
    }>(enumObject: TEnumObject, value: number): keyof typeof enumObject;

Parameters

Parameter Type Description
enumObject TEnumObject  
value number  

Returns:

keyof typeof enumObject