Answers for "get type of element of array typescript"

0

get type of element of array typescript

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 "get type of element of array typescript"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language