fu8ar fu8ar - 1 month ago 10
TypeScript Question

es6 Map() doesn't compile to es5 when using Typescript

I've just started using Typescript in a project for the first time.

I really want to use Map() to organize a small array of key value pairs.

Unfortunately when the typescript is compiled (using gulp and gulp-typescript) to vanilla, ES5 JavaScript, Map() still exists. I need this code to work in ie9.

Any advice at this stage would be greatly appreciated.

Answer

Map is a part of ES6 and have nothing to do with TypeScript.

If you want tot use Map in ES5 environment you should include an appropriate polyfill.

My first two thoughts are:

Comments