-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Closed
Copy link
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
TS Template added by @mjbvz
TypeScript Version: 4.1.2
Search Terms
- react
- jsx
- VSCode Version: 1.51.1
- OS Version: Windows 10 Pro
React 17 introduced a new JSX transform which does not require react to be imported in every file. Support for this was added in TypeScript 4.1. However vscode is still suggesting/requiring the react import before other JSX import fixes are suggested.
Steps to Reproduce:
npx create-react-app my-app --template typescript
cd my-app
code --disable-extensions .
- Tell vscode to use the Workspace TypeScript version (4.1.2).
- Add a
src/Test.tsx
file with contentexport default function Test() { return <App />; }
. It should show a problemCannot find name 'App'.
. - Click to show fixes. It unnecessarily suggests/requires
import default 'React' from module "react"
before it will suggest the desiredimport default 'App' from module "./App"
.
In short, you can't get help with JSX imports without littering your files with unnecessary react imports.
Does this issue occur when all extensions are disabled?: Yes
agg23, vsaarinen, nitesh-tosniwal, Emiliano-Bucci, alex3683 and 97 morenghiepdev, freeatnet, dashkb and Admiralfeb
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue