-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
import suggestion for node modules includes entire path #52089
Comments
(Experimental duplicate detection) |
now that I'm browsing though other issues, looks related to #52022 |
@no-stack-dub-sack Did you manually install |
@mjbvz lodash is a part of the application scaffold I am using at work, so I never installed lodash at all, and I can't see the package.json of the generator that produces the node_modules for me, but I'm guessing @types/lodash is being installed separately from lodash rather than using the built in types since it makes it in to the @types directory. However, in the past (until I updated), the suggestion always produced an import without the complete path — is this the new expected behavior when types are installed separately? |
@mjbvz Also, for another example - I just installed another package to the project myself via yarn which has it's own index.d.ts file. When I try to import a type from that package, I get the same behavior - it suggests |
Same as microsoft/TypeScript#23230 Please share more information about your project structure. Are you opening a loose file or are you opening a folder? Do you have a jsconfig.json? What is the directory structure like? Where is |
@mjbvz Sure:
Let me know if you need more info |
I'm also running into this same problem, and have a very standard TS project setup. This started happening on 2.9.2 |
I'm having trouble reproducing this -- could you try and come up with a particular set of files that reproduces the issue? Presumably this can be reproduced with a setup like the following? node_modules/xxx/index.d.ts export const xxx: number; src/a.ts /// <reference types="xxx" />
xxx // Import fix here tsconfig.json: {
"compilerOptions": {
<<settings needed to reproduce the issue here>>
}
} With just those files (and empty |
@andy-ms The issue exists in a fresh Angular install.
and edit app.component.ts or some other file with node_modules import. tsconfig.json
tsconfig.app.json
|
@krokofant Thanks! I can only reproduce that on windows for some reason. |
Fixed by microsoft/TypeScript#25364. @mjbvz Could you close this? |
Thanks @andy-ms! |
So I take it this did not make it into 1.25.1? Do we have to wait until the September release to see the fix for this regression? Thanks for any insights. |
I'm having this issue for all imports and i'm not using TS at all. |
Not sure if I should be opening this since this is a part of the insiders build, but since my most recent update, I've noticed that the import suggestions for installed modules like lodash include the entire path to the module, rather than just
import something from 'module'
. In the screenshot above you can see what I mean, the comment at the top is the result of accepting the suggestion, when it could simply beEDIT: I've also just noticed that it seems to be suggesting the type rather than the actual function that I need. This may be at the heart of the problem?
Steps to Reproduce:
Does this issue occur when all extensions are disabled?: Yes
The text was updated successfully, but these errors were encountered: