-
Notifications
You must be signed in to change notification settings - Fork 12k
import as
results in the alias being undefined with Typescript 3.2
#13212
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
Comments
It's unclear why `import as` results in the aliases to be undefined. Plain tsc seems to do the right thing and emits the correct code, so it might be some kind of interaction in @angular/cli or webpack that are causing the failure. This should be investigated separately from the tsc update in angular/angular. See angular/angular-cli#13212
hmm.. unfortunately I can't seem to be able to reproduce this outside of angular.io... in aio it's quite easy to repro this, but I don't know what makes aio special. |
It's unclear why `import as` results in the aliases to be undefined. Plain tsc seems to do the right thing and emits the correct code, so it might be some kind of interaction in @angular/cli or webpack that are causing the failure. This should be investigated separately from the tsc update in angular/angular. See angular/angular-cli#13212
I have spent all day tearing my hair out trying to nail this down... I'm glad to see I'm not alone. I also haven't been able to make a lightweight reproduction yet -- I have a lot of moving pieces in my (broken) build and thought it might have been some interaction between webpack, the DLL/DLLReference plugins, and the AOT compiler. I just finally figured out that it must be something to do with I'm going to spend a little more time trying to make a compact reproduction but if it's impossible to build core Angular as-is under TS 3.2, that's probably good enough to make sure it gets addressed. I just hope we don't spend too long with "workarounds" like taking out aliasing completely. I don't just use those as a nice-to-have, I have a dependency where they export a variable I need called "Math"... and I need to access the actual Math object in the same place. As far as I can tell I don't really have any recourse other than aliasing (or renaming the global Math somewhere, which is definitely worse). |
Just noticed that this corresponds with a change in import-alias behavior in a recent VSCode version, and I'm wondering if there's some connection? See e.g. this issue. |
I had a quick look at this, and it seems that this is only happening in AIO is "special" because it's |
It's unclear why `import as` results in the aliases to be undefined. Plain tsc seems to do the right thing and emits the correct code, so it might be some kind of interaction in @angular/cli or webpack that are causing the failure. This should be investigated separately from the tsc update in angular/angular. See angular/angular-cli#13212 PR Close #27536
It's unclear why `import as` results in the aliases to be undefined. Plain tsc seems to do the right thing and emits the correct code, so it might be some kind of interaction in @angular/cli or webpack that are causing the failure. This should be investigated separately from the tsc update in angular/angular. See angular/angular-cli#13212 PR Close angular#27536
It's unclear why `import as` results in the aliases to be undefined. Plain tsc seems to do the right thing and emits the correct code, so it might be some kind of interaction in @angular/cli or webpack that are causing the failure. This should be investigated separately from the tsc update in angular/angular. See angular/angular-cli#13212 PR Close angular#27536
…ed with Typescript 3.2 When using the `specifier.propertyName` with `typeChecker.getSymbolAtLocation` it will return a more detailed symbol then we originally have in the `usedSymbols` set. We should probably use `symbol.id` to actually check if the symbols are the same, however the `id` is not exposed in the Symbol interface. Using `node.name` will return the same symbol that we have stored in the set. Fixes #13212
Does this issue automatically get notified when the patch is included in a published release? If not, do we have an ETA on when this might land? |
This also adds the option to provide addition files when using `createTypescriptContext` this is paramount for the elide imports tests as without this certain symbols won't have the full details. Which will cause tests to be false positive and re-surface issues like #13212
This also adds the option to provide addition files when using `createTypescriptContext` this is paramount for the elide imports tests as without this certain symbols won't have the full details. Which will cause tests to be false positive and re-surface issues like #13212
we usually cut patch releases every week. unfortunately we currently don't
have an automated way to post a comment on an issue once the fix is
released in a patch version, but that's not a bad idea. would you mind
filing an issue with such request? thanks
…On Thu, Dec 20, 2018 at 12:07 AM James Bromwell ***@***.***> wrote:
Does this issue automatically get notified when the patch is included in a
published release? If not, do we have an ETA on when this might land?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#13212 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AANM6N8AW2UQ9y8pbyWwaJD6BtjXdR3oks5u60VYgaJpZM4ZXpFJ>
.
|
It's unclear why `import as` results in the aliases to be undefined. Plain tsc seems to do the right thing and emits the correct code, so it might be some kind of interaction in @angular/cli or webpack that are causing the failure. This should be investigated separately from the tsc update in angular/angular. See angular/angular-cli#13212 PR Close angular#27536
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
…ed with Typescript 3.2 When using the `specifier.propertyName` with `typeChecker.getSymbolAtLocation` it will return a more detailed symbol then we originally have in the `usedSymbols` set. We should probably use `symbol.id` to actually check if the symbols are the same, however the `id` is not exposed in the Symbol interface. Using `node.name` will return the same symbol that we have stored in the set. Fixes angular#13212
Bug Report or Feature Request (mark with an
x
)Command (mark with an
x
)Versions
Repro steps
After typescript 3.2 upgrade, I've started seeing e2e test failures due to certain symbols not being defined - in all cases these symbols came from rxjs and were aliased to a different name.
The problem occurs during dev builds without optimizations turned on and causes both
ng serve
andng e2e
to fail with runtime errors in the browserFor example:
Would end up with
fromPromise
being undefined at runtime.Workarounds
as
alias and refactor the code to use the original symbol name.More info
I'll try to create a minimal reproduction outside of aio but for now you can review the "workaround" commit in https://github.com/angular/angular/pull/27536/commits
In the meantime I've tested the
as
imports in vanilla tsc and it seems to be working just fine there, so I suspect that it's some kind of interaction with cli or webpack that is causing this.The text was updated successfully, but these errors were encountered: