📜  将字符串数组转换为文字类型的联合 - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:38.748000             🧑  作者: Mango

代码示例1
// Only works for literal arrays

const someArr = ["a", "b", "c"] as const

type UnionOfSomeArrValue = typeof someArr[number] // => "a" | "b" | "c"