Answers for "typescript type with array"

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 type with array"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language