📜  来自数组的 typescript 类型 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:23.133000             🧑  作者: Mango

代码示例2
const animals = ['cat', 'dog', 'mouse'] as const
type Animal = typeof animals[number]

// type Animal = 'cat' | 'dog' | 'mouse'