Say I have list
const list = ['a', 'b', 'c']
Is it possible to derive from this value union type that is 'a' | 'b' | 'c'?
I want this because I want to define type which allows only values from static array, and also need to enumerate these values at runtime, so I use array.
Example how it can be implemented with an indexed object:
const indexed = {a: null, b: null, c: null}
const list = Object.keys(index)
type NeededUnionType = keyof typeof indexed
I wonder if it is possible to do it without using an indexed map.