-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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] better types for React.Children, second generic parameter for ReactElement #32279
[react] better types for React.Children, second generic parameter for ReactElement #32279
Conversation
@ferdaber Thank you for submitting this PR! 🔔 @iocat @cprecioso @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz @theruther4d @guilhermehubner @jrakotoharisoa @pascaloliv @Hotell @franklixuefei @Kovensky @pshrmn @Lavoaster - please review this PR in the next few days. Be sure to explicitly select If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead. |
After 5 days, no one has reviewed the PR 😞. A maintainer will be reviewing the PR in the next few days and will either merge it or request revisions. Thank you for your patience! |
@ferdaber The Travis CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
@ferdaber The Travis CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
@@ -2670,7 +2671,7 @@ type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps | |||
declare global { | |||
namespace JSX { | |||
// tslint:disable-next-line:no-empty-interface | |||
interface Element extends React.ReactElement<any> { } | |||
interface Element extends React.ReactElement<any, any> { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just let the second arg be default
'd to the constraint, rather than any
here.
@Jessidhia @johnnyreilly Can you review? |
Merged - thanks! |
Oops, disregard - I misread the inferred types. |
React.Children.only now returns ReactNode DefinitelyTyped/DefinitelyTyped#32279
Context
A lot of these changes are to help library authors better manipulate the
ReactElement
black box, and children in general.Please fill in this template.
npm test
.)npm run lint package-name
(ortsc
if notslint.json
is present).Select one of these and delete the others:
If changing an existing definition:
tslint.json
containing{ "extends": "dtslint/dt.json" }
.