@samitouri / QOS-React / commits / d8d7edde5d

Upgrade flow-bin to 0.53.1 (#10510)

* Update flow-bin to 0.53.1 * Ran flow-upgrade utility Manually corrected a few over-eager cases where it tried to replace our ReactElement sub-type. * Replaced a couple of React.Element types with React * Removed temporary ReactComponent/ReactComponent Flow types * Prettier * Replaced React with React based on Dan's PR feedback

Brian Vaughn committed Aug 28, 2017 at 14:39 UTC d8d7edde5d9de832039e971ad744002ed8f5fa4b
23 files changed +47 -57
.flowconfig
+1 -1
@@ -39,4 +39,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
39 suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
40
41 [version]
42 -^0.52.0
42 +^0.53.1
flow/environment.js
+1 -5
@@ -13,8 +13,4 @@
13
14 declare var __REACT_DEVTOOLS_GLOBAL_HOOK__: any; /*?{
15 inject: ?((stuff: Object) => void)
16 -};*/
17 -
18 -// temporary patches for React.Component and React.Element
19 -declare var ReactComponent: typeof React$Component;
20 -declare var ReactElement: typeof React$Element;
16 +};*/
\ No newline at end of file
flow/react-native-host-hooks.js
+1 -1
@@ -83,5 +83,5 @@ declare module 'UIManager' {
83 ) : Promise<any>;
84 }
85 declare module 'View' {
86 - declare var exports : typeof ReactComponent;
86 + declare var exports : typeof React$Component;
87 }
package.json
+1 -1
@@ -54,7 +54,7 @@
54 "fbjs": "^0.8.9",
55 "fbjs-scripts": "^0.6.0",
56 "filesize": "^3.5.6",
57 - "flow-bin": "^0.52.0",
57 + "flow-bin": "^0.53.1",
58 "git-branch": "^0.3.0",
59 "glob": "^6.0.4",
60 "glob-stream": "^6.1.0",
src/renderers/dom/fiber/ReactDOMFiberEntry.js
+5 -9
@@ -546,7 +546,7 @@ ReactGenericBatching.injection.injectFiberBatchedUpdates(
546 var warnedAboutHydrateAPI = false;
547
548 function renderSubtreeIntoContainer(
549 - parentComponent: ?ReactComponent<any, any, any>,
549 + parentComponent: ?React$Component<any, any>,
550 children: ReactNodeList,
551 container: DOMContainer,
552 forceHydrate: boolean,
@@ -649,17 +649,13 @@ function renderSubtreeIntoContainer(
649 }
650
651 var ReactDOMFiber = {
652 - hydrate(
653 - element: ReactElement<any>,
654 - container: DOMContainer,
655 - callback: ?Function,
656 - ) {
652 + hydrate(element: React$Node, container: DOMContainer, callback: ?Function) {
653 // TODO: throw or warn if we couldn't hydrate?
654 return renderSubtreeIntoContainer(null, element, container, true, callback);
655 },
656
657 render(
662 - element: ReactElement<any>,
658 + element: React$Element<any>,
659 container: DOMContainer,
660 callback: ?Function,
661 ) {
@@ -705,8 +701,8 @@ var ReactDOMFiber = {
701 },
702
703 unstable_renderSubtreeIntoContainer(
708 - parentComponent: ReactComponent<any, any, any>,
709 - element: ReactElement<any>,
704 + parentComponent: React$Component<any, any>,
705 + element: React$Element<any>,
706 containerNode: DOMContainer,
707 callback: ?Function,
708 ) {
src/renderers/dom/shared/findDOMNode.js
+1 -1
@@ -29,7 +29,7 @@ let findStack = function(arg) {
29 };
30
31 const findDOMNode = function(
32 - componentOrElement: Element | ?ReactComponent<any, any, any>,
32 + componentOrElement: Element | ?React$Component<any, any>,
33 ): null | Element | Text {
34 if (__DEV__) {
35 var owner = (ReactCurrentOwner.current: any);
src/renderers/dom/stack/server/ReactServerUpdateQueue.js
+5 -5
@@ -19,7 +19,7 @@ var warning = require('fbjs/lib/warning');
19 import type {Transaction} from 'Transaction';
20
21 function warnNoop(
22 - publicInstance: ReactComponent<any, any, any>,
22 + publicInstance: React$Component<any, any>,
23 callerName: string,
24 ) {
25 if (__DEV__) {
@@ -58,7 +58,7 @@ class ReactServerUpdateQueue {
58 * @protected
59 * @final
60 */
61 - isMounted(publicInstance: ReactComponent<any, any, any>): boolean {
61 + isMounted(publicInstance: React$Component<any, any>): boolean {
62 return false;
63 }
64
@@ -78,7 +78,7 @@ class ReactServerUpdateQueue {
78 * @internal
79 */
80 enqueueForceUpdate(
81 - publicInstance: ReactComponent<any, any, any>,
81 + publicInstance: React$Component<any, any>,
82 callback?: Function,
83 callerName?: string,
84 ) {
@@ -103,7 +103,7 @@ class ReactServerUpdateQueue {
103 * @internal
104 */
105 enqueueReplaceState(
106 - publicInstance: ReactComponent<any, any, any>,
106 + publicInstance: React$Component<any, any>,
107 completeState: Object | Function,
108 callback?: Function,
109 callerName?: string,
@@ -131,7 +131,7 @@ class ReactServerUpdateQueue {
131 * @internal
132 */
133 enqueueSetState(
134 - publicInstance: ReactComponent<any, any, any>,
134 + publicInstance: React$Component<any, any>,
135 partialState: Object | Function,
136 callback?: Function,
137 callerName?: string,
src/renderers/native/ReactNativeComponent.js
+1 -1
@@ -45,7 +45,7 @@ import type {
45 * @abstract
46 */
47 class ReactNativeComponent<DefaultProps, Props, State>
48 - extends React.Component<DefaultProps, Props, State> {
48 + extends React.Component<Props, State> {
49 static defaultProps: $Abstract<DefaultProps>;
50 props: Props;
51 state: $Abstract<State>;
src/renderers/native/ReactNativeFiberEntry.js
+1 -1
@@ -48,7 +48,7 @@ const ReactNativeFiber: ReactNativeType = {
48
49 findNodeHandle: findNumericNodeHandle,
50
51 - render(element: ReactElement<any>, containerTag: any, callback: ?Function) {
51 + render(element: React$Element<any>, containerTag: any, callback: ?Function) {
52 let root = roots.get(containerTag);
53
54 if (!root) {
src/renderers/native/ReactNativeTypes.js
+1 -3
@@ -11,8 +11,6 @@
11 */
12 'use strict';
13
14 -import type React from 'react';
15 -
14 export type MeasureOnSuccessCallback = (
15 x: number,
16 y: number,
@@ -78,7 +76,7 @@ export type ReactNativeType = {
76 NativeComponent: any,
77 findNodeHandle(componentOrHandle: any): ?number,
78 render(
81 - element: React.Element<any>,
79 + element: React$Element<any>,
80 containerTag: any,
81 callback: ?Function,
82 ): any,
src/renderers/native/takeSnapshot.js
+1 -1
@@ -33,7 +33,7 @@ const findNumericNodeHandle = require('findNumericNodeHandle');
33 * @platform ios
34 */
35 function takeSnapshot(
36 - view?: 'window' | ReactElement<any> | number,
36 + view?: 'window' | React$Element<any> | number,
37 options?: {
38 width?: number,
39 height?: number,
src/renderers/noop/ReactNoopEntry.js
+3 -3
@@ -251,12 +251,12 @@ var ReactNoop = {
251 },
252
253 // Shortcut for testing a single root
254 - render(element: ReactElement<any>, callback: ?Function) {
254 + render(element: React$Element<any>, callback: ?Function) {
255 ReactNoop.renderToRootWithID(element, DEFAULT_ROOT_ID, callback);
256 },
257
258 renderToRootWithID(
259 - element: ReactElement<any>,
259 + element: React$Element<any>,
260 rootID: string,
261 callback: ?Function,
262 ) {
@@ -281,7 +281,7 @@ var ReactNoop = {
281 },
282
283 findInstance(
284 - componentOrElement: Element | ?ReactComponent<any, any, any>,
284 + componentOrElement: Element | ?React$Component<any, any>,
285 ): null | Instance | TextInstance {
286 if (componentOrElement == null) {
287 return null;
src/renderers/shared/fiber/ReactFiberReconciler.js
+4 -4
@@ -160,7 +160,7 @@ export type Reconciler<C, I, TI> = {
160 updateContainer(
161 element: ReactNodeList,
162 container: OpaqueRoot,
163 - parentComponent: ?ReactComponent<any, any, any>,
163 + parentComponent: ?React$Component<any, any>,
164 callback: ?Function,
165 ): void,
166 performWithPriority(priorityLevel: PriorityLevel, fn: Function): void,
@@ -172,7 +172,7 @@ export type Reconciler<C, I, TI> = {
172 // Used to extract the return value from the initial render. Legacy API.
173 getPublicRootInstance(
174 container: OpaqueRoot,
175 - ): ReactComponent<any, any, any> | TI | I | null,
175 + ): React$Component<any, any> | TI | I | null,
176
177 // Use for findDOMNode/findHostNode. Legacy API.
178 findHostInstance(component: Fiber): I | TI | null,
@@ -256,7 +256,7 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
256 updateContainer(
257 element: ReactNodeList,
258 container: OpaqueRoot,
259 - parentComponent: ?ReactComponent<any, any, any>,
259 + parentComponent: ?React$Component<any, any>,
260 callback: ?Function,
261 ): void {
262 // TODO: If this is a nested container, this won't be the root.
@@ -296,7 +296,7 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
296
297 getPublicRootInstance(
298 container: OpaqueRoot,
299 - ): ReactComponent<any, any, any> | PI | null {
299 + ): React$Component<any, any> | PI | null {
300 const containerFiber = container.current;
301 if (!containerFiber.child) {
302 return null;
src/renderers/shared/fiber/ReactFiberScheduler.js
+4 -2
@@ -111,7 +111,9 @@ if (__DEV__) {
111 stopCommitLifeCyclesTimer,
112 } = require('ReactDebugFiberPerf');
113
114 - var warnAboutUpdateOnUnmounted = function(instance: ReactClass<any>) {
114 + var warnAboutUpdateOnUnmounted = function(
115 + instance: React$ComponentType<any>,
116 + ) {
117 const ctor = instance.constructor;
118 warning(
119 false,
@@ -123,7 +125,7 @@ if (__DEV__) {
125 );
126 };
127
126 - var warnAboutInvalidUpdates = function(instance: ReactClass<any>) {
128 + var warnAboutInvalidUpdates = function(instance: React$ComponentType<any>) {
129 switch (ReactDebugCurrentFiber.phase) {
130 case 'getChildContext':
131 warning(
src/renderers/shared/fiber/ReactFiberTreeReflection.js
+1 -3
@@ -70,9 +70,7 @@ exports.isFiberMounted = function(fiber: Fiber): boolean {
70 return isFiberMountedImpl(fiber) === MOUNTED;
71 };
72
73 -exports.isMounted = function(
74 - component: ReactComponent<any, any, any>,
75 -): boolean {
73 +exports.isMounted = function(component: React$Component<any, any>): boolean {
74 if (__DEV__) {
75 const owner = (ReactCurrentOwner.current: any);
76 if (owner !== null && owner.tag === ClassComponent) {
src/renderers/shared/fiber/isomorphic/ReactTypes.js
+3 -3
@@ -13,16 +13,16 @@
13 'use strict';
14
15 export type ReactNode =
16 - | ReactElement<any>
16 + | React$Element<any>
17 | ReactCoroutine
18 | ReactYield
19 | ReactPortal
20 | ReactText
21 | ReactFragment;
22
23 -export type ReactFragment = ReactEmpty | Iterable<ReactNode>;
23 +export type ReactFragment = ReactEmpty | Iterable<React$Node>;
24
25 -export type ReactNodeList = ReactEmpty | ReactNode;
25 +export type ReactNodeList = ReactEmpty | React$Node;
26
27 export type ReactText = string | number;
28
src/renderers/shared/shared/event/ReactSyntheticEventType.js
+1 -1
@@ -33,4 +33,4 @@ export type ReactSyntheticEvent = {
33 nativeTarget: Event,
34 nativeEventTarget: EventTarget,
35 ) => ReactSyntheticEvent,
36 -} & SyntheticEvent;
36 +} & SyntheticEvent<>;
src/renderers/shared/shared/getContextForSubtree.js
+1 -1
@@ -20,7 +20,7 @@ let getContextFiber = function(arg) {
20 };
21
22 function getContextForSubtree(
23 - parentComponent: ?ReactComponent<any, any, any>,
23 + parentComponent: ?React$Component<any, any>,
24 ): Object {
25 if (!parentComponent) {
26 return emptyObject;
src/renderers/shared/stack/reconciler/ReactNodeTypes.js
+1 -1
@@ -23,7 +23,7 @@ var ReactNodeTypes = {
23 COMPOSITE: 1,
24 EMPTY: 2,
25
26 - getType: function(node: ReactElement<any>): ReactNodeType {
26 + getType: function(node: React$Element<any>): ReactNodeType {
27 if (node === null || node === false) {
28 return ReactNodeTypes.EMPTY;
29 } else if (React.isValidElement(node)) {
src/renderers/shared/stack/reconciler/flattenStackChildren.js
+3 -3
@@ -43,7 +43,7 @@ if (
43 */
44 function flattenSingleChildIntoContext(
45 traverseContext: mixed,
46 - child: ReactElement<any>,
46 + child: React$Element<any>,
47 name: string,
48 selfDebugID?: number,
49 ): void {
@@ -82,9 +82,9 @@ function flattenSingleChildIntoContext(
82 * @return {!object} flattened children keyed by name.
83 */
84 function flattenStackChildren(
85 - children: ReactElement<any>,
85 + children: React$Element<any>,
86 selfDebugID?: number,
87 -): ?{[name: string]: ReactElement<any>} {
87 +): ?{[name: string]: React$Element<any>} {
88 if (children == null) {
89 return children;
90 }
src/renderers/testing/ReactTestRendererFiberEntry.js
+3 -3
@@ -32,7 +32,7 @@ import type {Fiber} from 'ReactFiber';
32 import type {FiberRoot} from 'ReactFiberRoot';
33
34 type TestRendererOptions = {
35 - createNodeMock: (element: ReactElement<any>) => any,
35 + createNodeMock: (element: React$Element<any>) => any,
36 };
37
38 type ReactTestRendererJSON = {|
@@ -551,7 +551,7 @@ function propsMatch(props: Object, filter: Object): boolean {
551 }
552
553 var ReactTestRendererFiber = {
554 - create(element: ReactElement<any>, options: TestRendererOptions) {
554 + create(element: React$Element<any>, options: TestRendererOptions) {
555 var createNodeMock = defaultTestOptions.createNodeMock;
556 if (options && typeof options.createNodeMock === 'function') {
557 createNodeMock = options.createNodeMock;
@@ -586,7 +586,7 @@ var ReactTestRendererFiber = {
586 }
587 return toTree(root.current);
588 },
589 - update(newElement: ReactElement<any>) {
589 + update(newElement: React$Element<any>) {
590 if (root == null || root.current == null) {
591 return;
592 }
src/shared/ReactElementType.js
+1 -1
@@ -29,7 +29,7 @@ export type ReactElement = {
29 _store: {
30 validated: boolean,
31 },
32 - _self: ReactElement,
32 + _self: React$Element<any>,
33 _shadowChildren: any,
34 _source: Source,
35 };
yarn.lock
+3 -3
@@ -1853,9 +1853,9 @@ flat-cache@^1.2.1:
1853 graceful-fs "^4.1.2"
1854 write "^0.2.1"
1855
1856 -flow-bin@^0.52.0:
1857 - version "0.52.0"
1858 - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.52.0.tgz#b6d9abe8bcd1ee5c62df386451a4e2553cadc3a3"
1856 +flow-bin@^0.53.1:
1857 + version "0.53.1"
1858 + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.53.1.tgz#9b22b63a23c99763ae533ebbab07f88c88c97d84"
1859
1860 flow-parser@0.43.0:
1861 version "0.43.0"