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

Incorrect emit for IIFE with assertion in property access in call expression #18668

Closed
DanielRosenwasser opened this issue Sep 21, 2017 · 1 comment
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@DanielRosenwasser
Copy link
Member

Input

(function a() { } as any)().foo()

Expected

(function a() { }().foo)();

Actual

function a() { }().foo();

Notice that this produces an un-parenthesized function expression.

Potentially addressable by work in #18300.

@DanielRosenwasser DanielRosenwasser added the Bug A bug in TypeScript label Sep 21, 2017
@mhegazy mhegazy added this to the TypeScript 2.6 milestone Sep 21, 2017
@weswigham
Copy link
Member

This is fixed in master. We currently emit (function a() { } as any)().foo() as (function a() { }().foo()); which is valid, thanks to the added enclosing parenthesis. I'll open a PR with a regression test shortly.

weswigham added a commit to weswigham/TypeScript that referenced this issue Oct 10, 2017
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Oct 10, 2017
weswigham added a commit that referenced this issue Oct 11, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants