Skip to content

There are no option to no transform async/await #8838

Description

TypeScript Version:

  • Version 1.9.0-dev.20160525-1.0

Code

// A self-contained demonstration of the problem follows...
async function getBar(params: number) {
    return 1;
}

transform into with --target ES6

Expected behavior:

  • Don't transform async/await with polyfill codes.
    • I would not like to transform async/awai in typescript phase, use babel or something to transform them, or use browser's natively support.
    • In this case, I'd like to use TypeScript compiler as a very nice type checker and down transform to ECMA262's latest standard syntax.

Actual behavior:

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments)).next());
    });
};
function getBar(params) {
    return __awaiter(this, void 0, void 0, function* () {
        return 1;
    });
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions