My array contains a mix of values:
const array = [false, 1, '', class T {}];
The type of the array is:
type arrayType = typeof array; // (string | number | boolean | typeof T) []
Each object at an index can have the following types:
string | number | boolean | typeof T
How can I determine the specific type of an object at a given index, rather than a union of types?
const a = array[0] // expected to be boolean
const b = array[1] // expected to be number
const c = array[2] // expected to be string
const d = array[3] // expected to be typeof T
TS Playground