我正在使用TypeScript的JSDoc形式,并尝试使用扩展对象的泛型。我的编辑器为声明类型为MyInterface<T>的参数的index.js代码提供了一个TypeScript错误,即Type 'T' does not satisfy the constraint '{如何指定接受约束JSDoc TypeScript中对象的<
我想定义一个泛型类型,在这种类型中,我可以将字符串值作为泛型参数传递,并使用它来定义类型上的键,例如: const foo: MyType<'hello'> = {}; 然而,我得到了一个错误,说An index signature parameter type must be 'string' or &