You can do:
let myArray: Array<TextInput | DateInput | Checkbox> = [];
And you can also do:
type MyArrayTypes = TextInput | DateInput | Checkbox;
let myArray: MyArrayTypes[] = [];
These two ways to define arrays are equidistant:
let a: number[] = [];
let b: Array<number> = [];
But sometimes the second method works better, as in your case.
source
share