实现一个通用工具类型 StringToUnion<T> ,接收 string 参数并转换为一个字母联合的类型。
StringToUnion<T>
string
例如:
type Test = '123'; type Result = StringToUnion<Test>; // expected to be "1" | "2" | "3"
TypeScript