javascript - Typescript, NodeJS, ES6 - findIndex on array -


so have issue using findindex es6 function on array in typescript , nodejs.

the error message i'm getting is:

requesttype.findindex not function

this code:

let weatherstates:array<string> = ['current', 'forecast']; let requesttype:string = 'current'; requesttype.findindex(weatherstates); 

and error gets thrown, i'm able use sorts of other es6 functionalities though, arrow functions etc.

it looks polyfill available in lib.core.d.ts typing though.

here mytsconfig.json setup:

{ "compileroptions": {     "module": "commonjs",     "target": "es6",     "sourcemap": true }, "exclude": [     "node_modules",     "typings" ] } 

i'm new typescript appreciated!

requesttype not array in example. string.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -