Skip to content
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

React 18 typescript problem #158

Closed
vocko opened this issue Apr 12, 2022 · 5 comments
Closed

React 18 typescript problem #158

vocko opened this issue Apr 12, 2022 · 5 comments

Comments

@vocko
Copy link

vocko commented Apr 12, 2022

React has recently released version 18 and along with it also a tightened type checking. This results in many error related to the children property on components.

 TS2769: No overload matches this call.
 Overload 1 of 2, '(props: ReflexElementProps | Readonly<ReflexElementProps>): ReflexElement', gave the following error.
<e>     Type '{ children: never[]; key: string; direction: -1; ref: MutableRefObject<ReflexElement | null>; className: any; size: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<ReflexElement> & Readonly<ReflexElementProps>'.
<e>       Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<ReflexElement> & Readonly<ReflexElementProps>'.
<e>   Overload 2 of 2, '(props: ReflexElementProps, context: any): ReflexElement', gave the following error.
<e>     Type '{ children: never[]; key: string; direction: -1; ref: MutableRefObject<ReflexElement | null>; className: any; size: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<ReflexElement> & Readonly<ReflexElementProps>'.
<e>       Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<ReflexElement> & Readonly<ReflexElementProps>'.
 TS2769: No overload matches this call.
<e>   Overload 1 of 2, '(props: ReflexContainerProps | Readonly<ReflexContainerProps>): ReflexContainer', gave the following error.
<e>     Type '{ children: Element[]; key: string; orientation: "horizontal"; style: { height: number; }; windowResizeAware: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<ReflexContainer> & Readonly<ReflexContainerProps>'.
<e>       Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<ReflexContainer> & Readonly<ReflexContainerProps>'.
<e>   Overload 2 of 2, '(props: ReflexContainerProps, context: any): ReflexContainer', gave the following error.
<e>     Type '{ children: Element[]; key: string; orientation: "horizontal"; style: { height: number; }; windowResizeAware: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<ReflexContainer> & Readonly<ReflexContainerProps>'.
<e>       Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<ReflexContainer> & Readonly<ReflexContainerProps>'.

I'm not a typescript expert but seems to me like children now has to be explicitly defined as a prop type.

@leefsmp
Copy link
Owner

leefsmp commented Apr 28, 2022

I will take a look at this asap ...

@akphi
Copy link
Contributor

akphi commented May 9, 2022

Hi, is there any update on this?

@AnabelSalomone
Copy link

AnabelSalomone commented May 11, 2022

@leefsmp Does the fact that renderOnResizeRate is not usable has to do with this issue? (type problem) Or should I open a new issue?

This is the error I get:
Property 'renderOnResize' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<ReflexElement> & Readonly<ReflexElementProps> & Readonly<...>'.t (sorry, the error is truncated)

@leefsmp
Copy link
Owner

leefsmp commented May 13, 2022

@akphi check version 4.0.8 please. ts definition should now be up-to-date. @AnabelSalomone, renderOnResizeRate was removed from the code as it caused problems, sorry for the bad news. I would need to look into it again at some point. If you have troubles with resizing, log an issue pls.

@Entkenntnis
Copy link

Thank you for fixing this! I can confirm that 4.0.8 is working fine with react 18 and next.js 12

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

No branches or pull requests

5 participants