[英]Missing type annotation for `T`
I am trying to build code with simple javascript function below: 我正在尝试使用以下简单的javascript函数构建代码:
filterArray(user: any, items: Array<Object>) {
items = items.filter(item => {return true;});
return items;
}
But I am getting below error: 但我得到以下错误:
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]
I am using flow and building using npm. 我正在使用流,并使用npm构建。
This error says your annotation is missing. 此错误表明您的注释丢失。 Add return type annotation to function
向函数添加返回类型注释
function add(x: number, y: number): number {
return x + y;
} }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.