Reputation: 895
While working with typescript in Visual Studio Code, I don't get module name autocomplete when importing 3rd party modules.
For example in:
import { Router } from 'react-router-dom'
I have to type full module name ('react-router-dom') while in plain JS I got suggestions.
Is this standard behavior of TS or is there any option to enable this autocomplete for example in tsconfig.json?
[EDIT]
This is example of my node tsconfig.json file
{
"compilerOptions": {
"target": "ES2020" ,
"module": "commonjs",
"sourceMap": true ,
"outDir": "./dist" ,
"strict": true ,
"moduleResolution": "node",
"esModuleInterop": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true ,
},
"include": ["src/**/*"]
}
Cheers
Upvotes: 2
Views: 2720
Reputation: 895
I found solution. In my vscode settings I've got unchecked:
TypeScript > Suggest: Paths
I don't know why, I have never been changing any settings of TS in my vscode editor. Problem solved.
[EDIT] Path Intellisense sets this option to false on install. In my case everything is working nice, only when I return to default TypeScript > Suggest > Paths: true.
Upvotes: 4
Reputation: 25
Type your word "Router" in your code and point the cursor at the end of the word and press Ctrl + space
to auto-complete. the autocomplete will automatically include the imports for you.
even for 3rd party lib also in VSCode.
Upvotes: 0