输入:
type Props = ['a', 'b', 'c']
输出源于 Props 类型:
Props
type Obj = { a: string, b: string, c: string }
只是想不通,但很肯定是有可能的。
可以使用类型查询获取 Props ( Props[number] )使用 Record
Props[number]
Record
type Obj = Record<Props[number], string>