rainerhahnekamp
rainerhahnekamp

Reputation: 1136

TypeScript target ES3

Array.prototype.indexOf and Date.now have been introduced in ES5. Why doesn't Typescript transpile, if I compile following code stored in file test.ts?

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

The command I use is tsc -t es3 test.ts. The resulting test.js is completely identical to test.ts.

Upvotes: 4

Views: 4417

Answers (1)

basarat
basarat

Reputation: 276333

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

  • TypeScript doesn't polyfill.
  • Use corejs to polyfill

More

Upvotes: 7

Related Questions