Skip to content

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

Closed

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

  1. mhegazy commented on May 26, 2016

    @mhegazy
    Contributor

    I believe you asking for --t ESNext target. see #5361 (comment)

    this is tracked bu #5361

  2. tetsuharuohzeki commented on May 30, 2016

    @tetsuharuohzeki
    Author

    this is tracked bu #5361

    Ah, okay. Thank you.

  3. locked and limited conversation to collaborators on Jun 19, 2018
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