简体   繁体   中英

Typescript visual studio 2015 es5

We are using visual studio 2015, and have the following typescript :-

class Form extends TestBase {
constructor(obj, settings) {
super();
super.automap(this, obj, Object.assign({}, settings, { overrides: { Template: Template } }));
  }
}

Using the visual studio 2015 typescript compiler, this compils down to :-

class Form extends TestBase {
constructor(obj, settings) {
    super();
    super.automap(this, obj, Object.assign({}, settings, { overrides: {} }));
}
}

Which is fine, and works great in chrome, however, we would like this to also work in ie10 / ie11.

i believe that we need to 'polyfill' this so that the js file generated is converted to es5.

Is there currently anything in visual studio that can do this? What is the best way for this conversion? or any samples?

From TypeScript 2.1 you can use spread syntax:

super.automap(this, obj, { ...settings, overrides: { Template: Template } } );

This will transpile into Object.assign , including polyfill.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM