microsoft / TypeScript-Babel-Starter

A sample setup using Babel CLI to build TypeScript code, and using TypeScript for type-checking.
MIT License
2k stars 229 forks source link

Polyfills for example Promise is not included automatically? #56

Open kolomu opened 4 years ago

kolomu commented 4 years ago

Hello, I tried the TypeScript-Babel-Starter setup. For some reason polyfills are not automatically included.

Am I missing something here? I thought that is the point of using babel.

Example:

function main() {
    return new Promise((resolve) => resolve("yes!"));
}

main();

Result:

function main() {
  return new Promise(function (resolve) {
    return resolve("yes!");
  });
}

main();

I haven't changed the file .babelrc / .tsconfig.

But also when adding in .babelrc the following preset it won't use Promise polyfill.

    [
      "@babel/preset-env",
      {
        "useBuiltIns": "entry"
      }
    ]

(also included a browserslist with IE11)