From da4dc9eaa2db15730ed812644474ca7bcf42cc59 Mon Sep 17 00:00:00 2001 From: Ross Pokorny Date: Wed, 11 Sep 2019 17:36:32 -0400 Subject: [PATCH 1/2] Add propTypes to ForwardRefExoticComponent --- types/react/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index fa5d1753066c07..4ab1e67ed7a16b 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -725,6 +725,7 @@ declare namespace React { // but can be given its own specific name interface ForwardRefExoticComponent

extends NamedExoticComponent

{ defaultProps?: Partial

; + propTypes?: WeakValidationMap

; } function forwardRef(Component: RefForwardingComponent): ForwardRefExoticComponent & RefAttributes>; From a4c9e186052135f0029fa8b44717618ed2c35adc Mon Sep 17 00:00:00 2001 From: Ross Pokorny Date: Thu, 12 Sep 2019 11:19:29 -0400 Subject: [PATCH 2/2] Add test --- types/react/test/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/react/test/index.ts b/types/react/test/index.ts index 7f8b13a437b8b7..13592faaebb0c6 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -403,6 +403,9 @@ const ForwardingRefComponent = React.forwardRef((props: {}, ref: React.Ref = {}; +ForwardingRefComponent.propTypes = ForwardingRefComponentPropTypes; + function RefCarryingComponent() { const ref: React.RefObject = React.createRef(); // Without the explicit type argument, TypeScript infers `{ref: React.RefObject}`