TypeScript 目标 ES3

TypeScript target ES3

Array.prototype.indexOfDate.now 已在 ES5 中引入。如果我编译存储在文件 test.ts 中的以下代码,为什么 Typescript 不能转译?

Date.now();
[1,2,3].indexOf(2);

我使用的命令是tsc -t es3 test.ts。结果 test.js 与 test.ts.

完全相同

Why doesn't Typescript transpile, if I compile following code stored in file test.ts?

  • TypeScript 没有 polyfill。
  • 使用 corejs 填充

更多