I am trying to build code with simple javascript function below:
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.
This error says your annotation is missing. Add return type annotation to function
function add(x: number, y: number): number {
return x + y;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.