I have one object with type as key and 0, 1, 2 integer as value and have a number enum that I would like to get key based on type value from obj. However the result is not as i expected. anyone may know why?
export declare enum SAMPLE {
AIR = 0,
EARTH = 1,
WATER = 2
}
const obj = [{type: 0}, {type: 2}]
obj.map(({type}: {type: number}) => SAMPLE[type])
// expected ['AIR', 'WATER']; actual [undefined, undefined]