打字稿视觉工作室2015年es5

时间:2017-03-13 11:22:45

标签: javascript visual-studio typescript ecmascript-6

我们正在使用visual studio 2015,并有以下打字稿: -

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

使用visual studio 2015打字稿编译器,这可归结为: -

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

哪个好,并且在chrome中效果很好,但是,我们希望这也适用于ie10 / ie11。

我相信我们需要' polyfill'这样生成的js文件就会转换为es5。

视觉工作室目前有什么可以做到的吗?这种转换的最佳方式是什么?或任何样品?

1 个答案:

答案 0 :(得分:0)

从TypeScript 2.1中,您可以使用扩展语法:

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

这将转换为Object.assign,包括polyfill。