Assume this:
export enum Day {
Monday = 111,
Tuesday = 222,
Wednesday = 333,
Thursday = 444,
Friday = 555,
Saturday = 666,
Sunday = 777,
}
Object.values(Day)
.filter(v => typeof v === 'number') // or filter(Number)
.map(numeric => console.log('numeric', numeric))
// more code to come
I am trying to build an array of custom objects out of an enum, such as { id: 111, label: 'Monday' } and I am struggling with types.
When hovering over numeric I would expect the type to be number, or maybe Day, but never unioned with | string, as I am filtering strings out just before it.
Why is that?