Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit with name-colliding helper functions is incorrect when target >=ES2015 #33547

Closed
joeywatts opened this issue Sep 23, 2019 · 3 comments
Closed
Assignees
Labels
Bug A bug in TypeScript

Comments

@joeywatts
Copy link
Contributor

joeywatts commented Sep 23, 2019

TypeScript Version: 3.6.3

Search Terms: helper rename

Code

// @target: es2015

declare function __awaiter(): void;
class C {
    async func() {
    }
}

Expected behavior:
Some sort of error is emitted (when the target requires the helper) notifying the user that the generated code will not work OR maybe the helper is emitted with an alternative name.

Actual behavior:
The emit declares an __awaiter function, but attempts to call __awaiter_1.

Playground Link: here

Related Issues:

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Sep 25, 2019
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 3.8.0 milestone Sep 25, 2019
@RyanCavanaugh
Copy link
Member

Fix: Add more underscores 😅

@srclark213
Copy link

Is there any news on this? I ran into a similar issue when an npm package I pulled in already had the helper __awaiter defined so calls changed to __awaiter_1 but no __awaiter_1 function ever got defined. Had to write a hack post-build script to set __awaiter_1 = __awaiter after compilation, would be great if this got fixed.

@rbuckton
Copy link
Member

This looks to be a duplicate of #33269, which was fixed by #36541.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants