我正在try 根据现有类型的键动态生成一个类型.
interface A {
X: number
}
type S = keyof A // correct "X"
type V = A[S] // correct: number
type B = {
[S]: A[S] // Error: A computed property name in a type literal must refer to an
// expression whose type is a literal type or a 'unique symbol' type.
}
基于其他类型的键生成具有动态属性的类型的正确方法是什么?