-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
Replace JSX
with React.JSX
#595
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
Heya @memark thanks for opening this PR. Changes look good, wondering though if this should be a major or minor update? 🤔 If it's minor then types will break for usual versioning? |
This is the info I could find (which is a bit vague) Digging through the TS defs I find this old declare global {
/**
* @deprecated Use `React.JSX` instead of the global `JSX` namespace.
*/
namespace JSX {
interface IntrinsicElements {
...
}
}
} new declare namespace React {
namespace JSX {
interface IntrinsicElements extends GlobalJSXIntrinsicElements {}
}
}
interface GlobalJSXIntrinsicElements extends JSX.IntrinsicElements {} meaning that both references end up in the same place. So not a breaking change I would say. |
Thanks for looking into it @memark. Looks good, I'll merge and push a new version. |
Published |
This change broke the documented workaround for getting types to work with Goober + Preact + Typescript. https://goober.js.org/features/typescript#note-when-using-preact // preact.d.ts
import JSX = preact.JSX; This variant seems to do the trick: // preact.d.ts
namespace React {
export import JSX = preact.JSX;
} |
Nice find! Seems like a reasonable fix. |
The global
JSX
type is deprecated in React 18.3 and removed in React 19 RC. This PR changes the code to use the supportedReact.JSX
syntax instead.