Skip to content

Import incorrectly removed during transpilation #24551

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

Closed
arciisine opened this issue Jun 1, 2018 · 5 comments
Closed

Import incorrectly removed during transpilation #24551

arciisine opened this issue Jun 1, 2018 · 5 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@arciisine
Copy link

Currently I'm having an issue where I've imported a variable, and the import is being removed during transpilation. The reference still remains, but the code breaks at runtime because the import is missing.

TypeScript Version: 3.0.0-dev.201xxxxx, 2.9.1, 2.9.0-dev.20180406

I was able to pinpoint the issue to 2.9.0-dev.20180406 but I am having issues creating a small repro case.

Search Terms:
Import missing reference

Code
I'm having trouble creating a contained repro, but the issue is currently occurring when an imported reference is used only in super clause of a constructor.

Expected behavior:
The import for an imported reference should exist after transpilation.

Actual behavior:
The import is removed during transpillation.

Playground Link:

Related Issues:

@afrieder
Copy link

afrieder commented Jun 1, 2018

I was able to reproduce this in http://www.typescriptlang.org/play/#src=import%20X%20from%20'file'%3B%0Aimport%20Z%20from%20'other_file'%3B%0A%0Aclass%20Y%20extends%20Z%20%7B%0A%20%20constructor()%20%7B%0A%20%20%20%20super(X)%3B%0A%20%20%7D%0A%7D

Note how file_1 is referenced but never declared.

@mhegazy mhegazy added the Bug A bug in TypeScript label Jun 1, 2018
@mhegazy mhegazy added this to the TypeScript 2.9.2 milestone Jun 1, 2018
@mhegazy
Copy link
Contributor

mhegazy commented Jun 1, 2018

@weswigham please take a look at this one for 2.9.2

@manu-st
Copy link

manu-st commented Jun 8, 2018

Is the fix in the latest version? I still have the issue as shown here: TypeStrong/ts-loader#787 (comment). In my case, there are multiple arguments when calling the super ().

@weswigham
Copy link
Member

The latest official release? Not yet - were planning to cut a release next week.

@manu-st
Copy link

manu-st commented Jun 8, 2018

My test is against version "3.0.0-dev.20180607".

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

No branches or pull requests

5 participants