Skip to content

Deemphasize old JSX transform #246738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2025

Conversation

eps1lon
Copy link
Contributor

@eps1lon eps1lon commented Apr 16, 2025

The old JSX transform requires a React import so you get a "This JSX tag requires 'React' to be in scope, but it could not be found.ts(2874)" for files without a tsconfig in VSCode by default.

However, the default nowadays is the new, automatic JSX transform in React which doesn't need a React import so VSCode should default to that.

Related:

@RyanCavanaugh
Copy link
Member

What do you think about preserve instead? It's the most agnostic/forgiving, right?

@eps1lon
Copy link
Contributor Author

eps1lon commented Apr 17, 2025

The problem with preserve is that it would not pick up any JSX types in that case even if you have @types/react installed. And I guess if you don't have any types installed, it would also not try to download @types/react with automatic type aquisition?

I can see why it makes more sense to be agnostic but I don't think preserve is the best practical choice as a default.

@mjbvz mjbvz enabled auto-merge April 28, 2025 23:56
@mjbvz mjbvz merged commit e665c52 into microsoft:main Apr 29, 2025
7 checks passed
@eps1lon eps1lon deleted the emphasize-automatic-transform branch April 29, 2025 09:34
NikolaRHristov pushed a commit to CodeEditorLand/Editor that referenced this pull request Apr 30, 2025
@jcalfee
Copy link

jcalfee commented May 21, 2025

Possibly related: I'm using solidjs and mostly it is usually fine without this error. But after moving files around, the editor occasionally gets hung up on This JSX tag requires 'React' to be in scope, but it could not be found. making it think everything, even , are an error (v1.98.2). I basically have to restart the editor to get this error to clear up (only affects certain files; likely the one I'm working with).

@eps1lon
Copy link
Contributor Author

eps1lon commented May 21, 2025

That seems unrelated to this change considering that error is the one you get with the previous defaults. The new default would not trigger this error since React doesn't need to be in scope with react-jsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants