如何修复TypeScript错误:TS2234:接口的所有声明必须具有相同的类型参数
在typescript v0.9.5中编译了此代码如何修复TypeScript错误:TS2234:接口的所有声明必须具有相同的类型参数,typescript,Typescript,在typescript v0.9.5中编译了此代码 interface Array { indexOfField : (propertyName: string, value: any) => number; } 升级到typescript 1.0后,出现以下错误: (2,11):错误TS2234:接口的所有声明必须具有相同的类型参数 行号2:11是关键字数组 我该如何解决这个问题 数组的另一个定义是lib.d.ts中的Array(带有类型参数)。您需要声明您的身份: inte
interface Array {
indexOfField : (propertyName: string, value: any) => number;
}
升级到typescript 1.0后,出现以下错误:
(2,11):错误TS2234:接口的所有声明必须具有相同的类型参数
行号2:11是关键字数组
我该如何解决这个问题 数组的另一个定义是
lib.d.ts
中的Array
(带有类型参数)。您需要声明您的身份:
interface Array<T> {
indexOfField : (propertyName: string, value: any) => number;
}
接口数组{
indexOfField:(propertyName:string,value:any)=>number;
}
以便具有相同数量的类型参数