@samitouri / QOS-React / commits / f89f25f471

Correct type of `ref` in forwardRef render() (#13100)

`React$ElementRef<T>` is the type of the ref _instance_ for a component of type T, whereas `React$Ref<T>` is the type of the ref _prop_ for a component of type T, which seems to be the intended type here.

Moti Zilberman committed Jul 11, 2018 at 22:27 UTC f89f25f4718c83b54b0e35c78a2608987db27f8a
1 file changed +1 -1
packages/react/src/forwardRef.js
+1 -1
@@ -10,7 +10,7 @@ import {REACT_FORWARD_REF_TYPE} from 'shared/ReactSymbols';
10 import warning from 'shared/warning';
11
12 export default function forwardRef<Props, ElementType: React$ElementType>(
13 - render: (props: Props, ref: React$ElementRef<ElementType>) => React$Node,
13 + render: (props: Props, ref: React$Ref<ElementType>) => React$Node,
14 ) {
15 if (__DEV__) {
16 if (typeof render !== 'function') {