`paths` not used for auto import
See original GitHub issueFrom https://github.com/Microsoft/vscode/issues/72931
TypeScript Version: 3.5.0-dev.20190430
Search Terms:
- paths
- auto import
Repo
- clone https://github.com/ac566/typescript-auto-import-issue and open in vscode
- In VS Code, set
"typescript.preferences.importModuleSpecifier": "non-relative"
- Open
src/app/app1/test.ts
- Delete the import for
TestType
- Try using a quick fix or auto import to add the impact back
Expected behavior:
The import is added as import { TestType } from "@myLib/example_2";
The is expected since the tsconfig configures paths
and the import of @myLib/example_2
was previously working properly:
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"baseUrl": ".",
"paths": {
"@myLib/*": [
"./src/lib/src/*/_index.ts"
]
}
}
}
Actual behavior:
The import is added as import { TestType } from "@myLib/example_2/_index";
Issue Analytics
- State:
- Created 4 years ago
- Reactions:15
- Comments:9
Top Results From Across the Web
VS Code auto imports not using absolute paths and not indented
When I type something that can be auto imported, as seen in the above GIF, the auto import doesn't keep things at the...
Read more >Auto-import does not use always tsconfig path mappings
When using tooltip, imports correctly use path mappings in ts-config (i.e. @location/component/etc). When the same class/object/whatever is imported during auto ...
Read more >Auto Import Relative Path - Visual Studio Marketplace
Auto import relative path without typing long and tedious import statements and file paths. This extension is an alternative solution of dragΒ ...
Read more >Documentation - Module Resolution - TypeScript
Finally, if the compiler could not resolve the module, it will log an error. ... Use non-relative paths when importing any of your...
Read more >Getting VSCode Auto Import To Work With React - Medium
Also, if your compiler get's caught up on an error about not being able to resolve a path after an Auto Import, make...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In my case just by using in my settings
and then setting in my tsconfig
compilerOptions.paths
my root as the last options I was able to import files using path correctlyThis creates
instead of
or
which is what i was looking for.
I got a same issue