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
Type error when using ReactModal as a JSX component.
Steps to reproduce:
Import ReactModal from react-modal.
Use ReactModal in a JSX component.
Compile the code.
Expected behavior:
The ReactModal component should render without type errors.
Additional notes:
This is the TypeScript error message:
'ReactModal' cannot be used as a JSX component.
Its type 'typeof ReactModal' is not a valid JSX element type.
Type 'typeof ReactModal' is not assignable to type 'new (props: any) => Component<any, any, any>'.
Construct signature return types 'ReactModal' and 'Component<any, any, any>' are incompatible.
The types returned by 'render()' are incompatible between these types.
Type 'import("/Users/nodirbekrajaboff/Desktop/projects/digital-aggregator/node_modules/@types/react-modal/node_modules/@types/react/index").ReactNode' is not assignable to type 'React.ReactNode'.
Type 'ReactElement<any, string | JSXElementConstructor<any>>' is not assignable to type 'ReactNode'.
Property 'children' is missing in type 'ReactElement<any, string | JSXElementConstructor<any>>' but required in type 'ReactPortal'.ts(2786)
Additional TypeScript error messages:
Type 'ReactElement<any, string | JSXElementConstructor<any>>' is not assignable to type 'ReactNode'.
Property 'children' is missing in type 'ReactElement<any, string | JSXElementConstructor<any>>' but required in type 'ReactPortal'.ts(2322)
index.d.ts(387, 9): 'children' is declared here.
index.d.ts(2156, 9): The expected type comes from property 'children' which is declared here on type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'
For: {contentElement}
No overload matches this call.
Overload 1 of 2, '(props: Props): ReactModal', gave the following error.
Type 'React.ReactNode' is not assignable to type 'import("/Users/nodirbekrajaboff/Desktop/projects/digital-aggregator/node_modules/@types/react-modal/node_modules/@types/react/index").ReactNode'.
Type 'bigint' is not assignable to type 'ReactNode'.
Overload 2 of 2, '(props: Props, context: any): ReactModal', gave the following error.
Type 'React.ReactNode' is not assignable to type 'import("/Users/nodirbekrajaboff/Desktop/projects/digital-aggregator/node_modules/@types/react-modal/node_modules/@types/react/index").ReactNode'.
Type 'bigint' is not assignable to type 'ReactNode'.ts(2769)
index.d.ts(41, 9): The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<ReactModal> & Readonly<Props>'
index.d.ts(41, 9): The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<ReactModal> & Readonly<Props>'
With React v19
Summary:
Type error when using
ReactModal
as a JSX component.Steps to reproduce:
ReactModal
fromreact-modal
.ReactModal
in a JSX component.Expected behavior:
The
ReactModal
component should render without type errors.Additional notes:
This is the TypeScript error message:
Additional TypeScript error messages:
For:
{contentElement}
For:
{children}
Codes:
The text was updated successfully, but these errors were encountered: