Open snowystinger opened 5 months ago
Ah, thanks for the links, I find it hard to keep track of what's happening in definitely typed vs in the actual home of the project
Seems like there's another discussion thread over here:
I asked about it in that thread, but maybe the plans for the global JSX
namespace in React 19 types indicate that MDX and related packages should be importing JSX
somehow instead of using it as a global namespace.
You need to do the same you're already doing for Preact and other libraries using JSX. Considering how you test types with other libraries, I'd assume you want something like DefinitelyTyped/DefinitelyTyped@ca06234
(#69142)
Inlining what I believe Sebastian links to:
Users can support the unreleased version of React 19’s types by defining the JSX
namespace that they remove:
import type {JSX as Jsx} from 'react/jsx-runtime'
declare global {
namespace JSX {
type ElementClass = Jsx.ElementClass
type Element = Jsx.Element
type IntrinsicElements = Jsx.IntrinsicElements
}
}
Initial checklist
Problem
React has removed the
JSX
global namespace in React 19, as a result, it needs to be accessed via theReact
global namespace nowReact.JSX.
Solution
Update references to JSX
Follow https://github.com/DefinitelyTyped/DefinitelyTyped/pull/69022 for how to install the pre-release of the types and if you can, use the codemod
Alternatives
I don't think there's an alternative here