Vscode suggests wrong ts auto import path with js extension after having a json import
See original GitHub issueTypeScript Version: 3.1.6, but also tried with 3.3.0-dev.201xxxxx
Search Terms: auto import json wrong module path js extension issue bug
Code
https://stackblitz.com/edit/typescript-json-import-issue
I am not using any vscode extension for managing imports and as far as I know vscode depends on typescript to show the module import suggestions, so I hope this is the right place for this issue.
tsconfig.json
{
"compilerOptions": {
"module": "es2015",
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true
}
}
Expected behavior:
When we have:
import packageJson from './package.json';
in VSCode auto import modules autocomplete to suggest:
import { testing } from './test';
Actual behavior:
in VSCode auto import modules autocomplete suggests:
import { testing } from './test.js';
Playground Link:
Related Issues:
Issue Analytics
- State:
- Created 5 years ago
- Reactions:14
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Auto import in Visual Studio Code only offering absolute path ...
I will pointout something: It is much better to have absolute path but starting from source dir (src/) like "import .. from "my-module/bla/bla/ClassName.js"Β ......
Read more >Managing Extensions in Visual Studio Code
VS Code makes it easy to manage your extensions. You can install, disable, update, and uninstall extensions through the Extensions view, the Command...
Read more >May 2022 (version 1.68) - Visual Studio Code
In this milestone, we have added support for deprecated extensions in VS Code. ... The Organize Imports command for JavaScript and TypeScript lets...
Read more >Editing Python in Visual Studio Code
Tip: Check out the IntelliCode extension for VS Code. ... Pylance offers auto import suggestions for modules in your workspace and/or packages you...
Read more >jsconfig.json Reference - Visual Studio Code
File Scope - no jsconfig.json: In this mode, JavaScript files opened in Visual Studio Code are treated as independent units. As long as...
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 Free
Top 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
I am noticing this behavior as well, except the extension is incorrect (itβs appending
.js
instead of leaving it off or using the correct.ts
)VSCode version: 1.33.1 (1.33.1)
tsconfig.json:
i can still reproduce this on 1.38.1