缺少“T”的类型注释
Missing type annotation for `T`
我正在尝试使用下面的简单 javascript 函数构建代码:
filterArray(user: any, items: Array<Object>) {
items = items.filter(item => {return true;});
return items;
}
但我遇到以下错误:
Missing type annotation for `T`. `T` is a type parameter declared in array type [1] and was implicitly instantiated at
call of method `filter` [2].
src/mod/test.js:69:15
69| items = items.filter(item => {return true;});
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2]
References:
src/mod/test.js:69:15
69| items = items.filter(item => {return true;});
^^^^^ [1]
我正在使用流并使用 npm 进行构建。
此错误表示您的注释丢失。向函数添加 return 类型注释
function add(x: number, y: number): number {
return x + y;
}
我正在尝试使用下面的简单 javascript 函数构建代码:
filterArray(user: any, items: Array<Object>) {
items = items.filter(item => {return true;});
return items;
}
但我遇到以下错误:
Missing type annotation for `T`. `T` is a type parameter declared in array type [1] and was implicitly instantiated at
call of method `filter` [2].
src/mod/test.js:69:15
69| items = items.filter(item => {return true;});
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2]
References:
src/mod/test.js:69:15
69| items = items.filter(item => {return true;});
^^^^^ [1]
我正在使用流并使用 npm 进行构建。
此错误表示您的注释丢失。向函数添加 return 类型注释
function add(x: number, y: number): number {
return x + y;
}