خرید بک لینک

Vote count: 0

So i have an issue with using findIndex ES6 function on an array in typescript and NodeJS.

The error message i'm getting is:

requestType.findIndex is not a function

this is my code:

let weatherStates:Array<string> = ['current', 'forecast'];
let requestType:string = 'current';
requestType.findIndex(weatherStates);

and then the error gets thrown, i'm able to use all sorts of other ES6 functionalities though, like the arrow functions etc.

it looks like that the polyfill is available in the lib.core.d.ts typing though.

Here is mytsconfig.json setup:

{
"compilerOptions": {
    "module": "commonjs",
    "target": "es6",
    "sourceMap": true
},
"exclude": [
    "node_modules",
    "typings"
]
}

i'm fairly new with typescript so any help would be greatly appreciated!

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 31 فروردين 1395 ساعت: 8:38

صفحه بندی