javascript - Map class in typescript giving an error -


i getting error saying "cannot find name map" in typescript .

var mymap = new map();  var keystring = "a string",     keyobj = {},     keyfunc = function () {};  // setting values mymap.set(keystring, "value associated 'a string'"); mymap.set(keyobj, "value associated keyobj"); mymap.set(keyfunc, "value associated keyfunc");  mymap.size; // 3  // getting values mymap.get(keystring);    // "value associated 'a string'" mymap.get(keyobj);       // "value associated keyobj" mymap.get(keyfunc);      // "value associated keyfunc"  mymap.get("a string");   // "value associated 'a string'"                          // because keystring === 'a string' mymap.get({});           // undefined, because keyobj !== {} mymap.get(function() {}) // undefined, because keyfunc !== function () {} 

i dont understand why not considering

moreover have map in javascript

any appreciated.

map part of es6, need "target" es6 in order work.


in typescript 2 can keep targeting es5 , include required apis lib option:

"compileroptions": {     "lib": ["es5", "es2015.collection"] } 

more info here.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -