字符串数组转换ts类型m|n 类型体操?-灵析社区
时光旅人
比如有一个数组const arr=['m','n']; type 转换成m|n
阅读量:265
点赞量:17
问AI
MastFancy
type A = T extends any[] ? T[number] : T; 数组转联合类型用 [number] 作为下标 "['1', '2']['number'] // '1' | '2'"