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

feat: Change return type of render to ReactNode #77

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

yroc92
Copy link
Contributor

@yroc92 yroc92 commented Jan 16, 2024

For compatibiility with React 18, we need the return type of render to be ReactNode instead of ReactElement.

Closes #74

@bvaughn
Copy link
Owner

bvaughn commented Jan 16, 2024

Shouldn't this be the opposite? Or is it only Function components that should now be ReactElement instead of ReactNode? I haven't been keeping up with that.

@yroc92
Copy link
Contributor Author

yroc92 commented Jan 16, 2024

@bvaughn
Copy link
Owner

bvaughn commented Jan 16, 2024

Hmm. It seems that for function components the change required is exactly the opposite of this (see bvaughn/react-resizable-panels#256)

I guess the Stack Overflow you linked to mentions this:

TS render types are currently limited to:
Class component: ReactNode (wider than permitted by React)
Function component: JSX.Element | null (more restrictive than React)

Looking at the TypeScript types in DefinitelyTyped, it does look like

render(): ReactNode

Kind of a pain in the ass 😄

Copy link
Owner

@bvaughn bvaughn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this change makes sense 🤷🏼 I dunno

@bvaughn bvaughn merged commit 7aa8650 into bvaughn:master Jan 16, 2024
@bvaughn
Copy link
Owner

bvaughn commented Jan 16, 2024

Change published in react-virtualized-auto-sizer@1.0.21


❤️ → ☕ givebrian.coffee

@yroc92
Copy link
Contributor Author

yroc92 commented Jan 16, 2024

Kind of a pain in the ass 😄

I agree 100%. Thank you!

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

Successfully merging this pull request may close these issues.

'AutoSizer' cannot be used as a JSX component.
2 participants