interface Foo {
[foo: "hello" | "world"]: string;
}
Run Code Online (Sandbox Code Playgroud)
我收到一条错误消息
An index signature parameter type cannot be a union type. Consider using a mapped object type instead.
Run Code Online (Sandbox Code Playgroud)
什么是映射对象类型,以及如何使用它?
typescript ×1