Answers for "array type in type script"

2

type script array

let list: number[] = [1, 2, 3];
Posted by: Guest on April-19-2020
0

typescript type from array

const animals = ['cat', 'dog', 'mouse'] as const
type Animal = typeof animals[number]

// type Animal = 'cat' | 'dog' | 'mouse'
Posted by: Guest on May-01-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language