-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Avoid unnecessary resolution-mode assertion in declaration emit #55727
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
Conversation
@mpodwysocki I was never able to repro a case where the declaration emitter included a duplicate triple-slash directive, so I can’t be sure whether this fixes the whole problem. Would you mind trying this build out on your repro? @typescript-bot pack this |
Heya @andrewbranch, I've started to run the tarball bundle task on this PR at 49f8c32. You can monitor the build here. |
Hey @andrewbranch, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
@andrewbranch it works perfectly, thank you! |
Heya @mpodwysocki, I've started to run the tarball bundle task on this PR at 49f8c32. You can monitor the build here. |
Hey @mpodwysocki, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
Fixes the bug part of #55579, where the manual triple-slash reference workaround doesn’t work for @types/node.
When a type reference directive is processed, we also record what additional files the resolved types bring in via
<reference path="..." />
directives. This way, when you reference a global declared innode_modules/@types/node/globals.d.ts
, we can see that it actually came in via a<reference types="node" />
. But instead of recording this entry with the resolution-mode that the types reference had, we recorded it with the resolution-mode that the file reference had, which is irrelevant (and could even lead to some totally incorrect results with some manufactured bizarre cases). All we need to know is how did this file enter the program? which is the type reference directive with whatever mode it had.