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

children props should be typed as ReactNode #72

Merged
merged 2 commits into from Nov 23, 2019

Conversation

polamjag
Copy link
Contributor

@polamjag polamjag commented Sep 24, 2019

ref. https://github.com/DefinitelyTyped/DefinitelyTyped/blob/41fe335d209b4cd46dedafd1a91849d7fec6880d/types/react/index.d.ts#L1218-L1222

Description

children props of React Components should have type of React.ReactNode.

Motivation and context

children of React Component may not only be Component but can be another forms, such as text node or else.

FYI: definition of Props type in @types/react also types children as ReactNode.

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/41fe335d209b4cd46dedafd1a91849d7fec6880d/types/react/index.d.ts#L1218-L1222

How has this been tested?

Not tested well, but I think this change will not break anything.

Screenshots (if relevant):

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

I think this is not breaking change because type React.Node accepts React.Component.

Checklist:

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the CONTRIBUTING document
  • I have added tests to cover my changes
  • All new and existing tests passed

@Rendez
Copy link
Contributor

Rendez commented Sep 26, 2019

We're waiting for a release cut of the spire package so that our builds are green again, then I'll merge this PR.

@Rendez Rendez marked this pull request as ready for review September 26, 2019 10:11
@polamjag
Copy link
Contributor Author

Thank you for your review! (And I'm sorry for leaving this p-r as WIP 🙇)
I've updated p-r description a little to describe more details.

@danez danez merged commit 50bc02d into researchgate:master Nov 23, 2019
@danez
Copy link
Contributor

danez commented Nov 23, 2019

Thanks again.

Rendez pushed a commit that referenced this pull request Nov 23, 2019
## [1.0.3](v1.0.2...v1.0.3) (2019-11-23)

### Bug Fixes

* **typings:** children props should be ReactNode ([#72](#72)) ([43aa3a2](43aa3a2)), closes [/github.com/DefinitelyTyped/DefinitelyTyped/blob/41fe335d209b4cd46dedafd1a91849d7fec6880d/types/react/index.d.ts#L1218-L1222](https://github.com//github.com/DefinitelyTyped/DefinitelyTyped/blob/41fe335d209b4cd46dedafd1a91849d7fec6880d/types/react/index.d.ts/issues/L1218-L1222)
@polamjag
Copy link
Contributor Author

Thank you too!

@polamjag polamjag deleted the patch-1 branch November 24, 2019 06:23
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.

None yet

3 participants