You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This causes the TypeScript error: Namespace 'global.JSX' has no exported member 'Element'. ts(2694)
The expected behavior should allow JSX.Element to be used without errors, even after extending the JSX.IntrinsicElements.
Suggested solution:
Extend the JSX namespace rather than replacing it entirely.
Add documentation on how to restore compatibility when using custom types.
As a stopgap of the issue, I currently have the following in my own global.d.ts that fixes the issue:
importReactfrom"react";declare global {namespaceJSX{interfaceIntrinsicElements{distortMaterialImpl?: any;}typeElement=React.ReactNode;}}
The text was updated successfully, but these errors were encountered:
three
version:^0.172.0
@react-three/fiber
version:^8.17.12
@react-three/drei
version:^9.120.8
node
version:v20.12.2
npm
(oryarn
) version:10.9.0
Problem description:
What happens:
Element
inJSX.Element
is missing due to anamespace JSX
override. As shown here: https://github.com/pmndrs/drei/blob/346326928346612f5d12f1f291699ce78aa0e5fd/src/core/MeshDistortMaterial.tsx#L19C1-L25C2Why this is problematic: It affects all files importing
JSX
types globally and breaks React's expected typings.Relevant code:
Snippet from my codebase:
This causes the TypeScript error:
Namespace 'global.JSX' has no exported member 'Element'. ts(2694)
The expected behavior should allow
JSX.Element
to be used without errors, even after extending theJSX.IntrinsicElements
.Suggested solution:
JSX
namespace rather than replacing it entirely.As a stopgap of the issue, I currently have the following in my own
global.d.ts
that fixes the issue:The text was updated successfully, but these errors were encountered: