-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Automatic Type Acquisition based on filename matching pulls in too many irrelevant typings #40123
Comments
This has heuristic that is at: TypeScript/src/server/project.ts Line 1711 in 31f4957
where it does ATA if the resolved module is not ts or json and is referenced using non relative name. This is been around for some time but i think the reason was that eg if you resolved to node_modules\mocha you instead want .d.ts file for it instead. May be adding check for isExternalLibraryImport might be a good addition to check there.
|
It's been like this forever yes, I think the original intent (@RyanCavanaugh would know) was to detect third party libraries in non-module based code, e.g. a project that just has |
|
Thanks for the pointer. To be clear, in the scenario I describe, there is no |
Consider a simple JavaScript project with files like the following
The names
flight
andplatform
seem innocuous enough, but their mere presence causes Automatic Type Acquisition to pull in@types/flight
and@types/platform
. Because these words are so common, I would argue it's highly unlikely that the user actually needs the typings for these libraries - much more likely that the files are just regular files in the user's project. I think ATA's behavior is a little too eager, and causes unnecessary files and symbols to be added to the project context. There's also no visual indication that this is actually happening (but you can confirm it by checking TS Server logs).This behavior happens in VS Code if you have the files open in the editor. But it occurs in VS if you have them present in your project at all.
I propose one or more of the following solutions:
jquery
.@DanielRosenwasser
The text was updated successfully, but these errors were encountered: