TypeScript: Auto-imports from within jsx don't work
Auto imports inside jsx stopped working on the latest stable release - worked before. When I try to use auto import, it show correct info about the identifier, but no way to auto import it:
However, whn I use auto import outside of jsx, it works (shows correct path and auto-imports on confirm):
Does this issue occur when all extensions are disabled?: Yes/No
Yes
- VS Code Version: 1.57.0
- OS Version: Darwin x64 19.6.0 (Catalina 10.15.7)
Steps to Reproduce:
- Open any react component
- Try to use auto import inside jsx
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 46
- Comments: 23 (2 by maintainers)
I’ve been experiencing the issue exactly as described, with the same VS Code version (1.57.0) and OS (Catalina 10.15.7).
The only known workaround appears to be typing the component name outside of JSX.
Additional info:
jsconfigfile, although did try adding one, to no availI can’t see the component name in other components. Intellisense/autocomplete not working. Doesn’t work on auto import.
Okay, probably i was wrong, sorry. Apparently it has nothing to do with paths (or paths are not the only reason) - it sometimes works with them and sometimes without them. It seems like the entire import/intellisense functionality is broken:
The dropdown suggests, that the
PescaTabBarcomponent is deprecated, even though it is not.For me, the issue seems to be related to path-aliases in
tsconfig.json. I have several entries like:If i remove these entries, some imports work (e.g. while typing the name of a component), while others (e.g.
CTRL + Space“after” an already written name) do not work reliably or do not work at all.It;s working now on vscode June update
Any news guys. Or should we rollback to previous version vscode?
@mjbvz try
npx create-react-app my-app --template typescriptand you will face the issue while trying to auto import jsx or tsx filesit work again after I update the JavaScript and TypeScript Nightly extension
Seems to be related to microsoft/vscode#126095.
I also experienced “working” intellisense/imports after randomly deleting characters in the name of the component i want to import (probably related to the slow intellisense).