Skip to content

Variable declaration list comments from async functions are removed #15323

Open
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

TypeScript Version: 2.2.1

Code

async function example() {
    // result.value will be promise
    const promise = Promise.resolve("foo");
    await promise;

    // result.value will be "foo"
    return "foo";
}

Expected behavior:

Ignoring __awaiter and __generator, the output should include // result.value will be promise

Actual behavior:

function example() {
    return __awaiter(this, void 0, void 0, function () {
        var promise;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    promise = Promise.resolve("foo");
                    return [4 /*yield*/, promise];
                case 1:
                    _a.sent();
                    // result.value will be "foo"
                    return [2 /*return*/, "foo"];
            }
        });
    });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Comment EmitThe issue relates to the emission of comments when compilingDomain: TransformsRelates to the public transform APIEffort: DifficultGood luck.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions