TypeScript 索引签名中名称的用途?
我可以在 Typescript 中做到这一点:
type Foo = {[key: string]: number}
然而,“key”的目的是什么?为什么不直接说
type Foo = {[string]: number}
网站搜索
我可以在 Typescript 中做到这一点:
type Foo = {[key: string]: number}
然而,“key”的目的是什么?为什么不直接说
type Foo = {[string]: number}