1// let arr_name, elemType[];
2let list: number[] = [1, 2, 3];
3// Generic array type, Array<elemType>:
4let list: Array<number> = [1, 2, 3];
1const animals = ['cat', 'dog', 'mouse'] as const
2type Animal = typeof animals[number]
3
4// type Animal = 'cat' | 'dog' | 'mouse'
1// You can create your list as enums
2enum statuses {
3 SETUP,
4 STARTED,
5 FINISHED
6}
7
8// Creates known string type
9// 'SETUP' | 'STARTED' | 'FINISHED'
10type StatusString = keyof typeof statuses
11
12// JobStatus.status must match 'SETUP' | 'STARTED' | 'FINISHED'
13export type JobStatus = {
14 status: StatusString
15}
16