From a71a787038bd3f4e449853368f219cf3a8ff0d26 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Thu, 25 Aug 2016 09:43:28 -0700 Subject: [PATCH] Update flow to 0.31 (#7557) (cherry picked from commit 08614db025b59d55701d0c6e02e8b3948a036f9f) --- .flowconfig | 8 +++++--- package.json | 2 +- src/renderers/shared/fiber/ReactChildFiber.js | 14 ++++++++++++++ .../shared/fiber/isomorphic/ReactCoroutine.js | 3 +++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.flowconfig b/.flowconfig index d15db1c9ab..81372434d1 100644 --- a/.flowconfig +++ b/.flowconfig @@ -28,10 +28,12 @@ munge_underscores=false suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FixMe +suppress_type=$FlowExpectedError -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-4]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-4]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*\\)?)\\)? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-1]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-1]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)?:? #[0-9]+ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy +suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError [version] -^0.27.0 +^0.31.0 diff --git a/package.json b/package.json index ab66cb0cf8..2d3ec4624f 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "eslint-plugin-react-internal": "file:eslint-rules", "fbjs": "^0.8.4", "fbjs-scripts": "^0.6.0", - "flow-bin": "^0.27.0", + "flow-bin": "^0.31.0", "glob": "^6.0.1", "grunt": "^0.4.5", "grunt-cli": "^0.1.13", diff --git a/src/renderers/shared/fiber/ReactChildFiber.js b/src/renderers/shared/fiber/ReactChildFiber.js index a0e5608b62..90ea04d095 100644 --- a/src/renderers/shared/fiber/ReactChildFiber.js +++ b/src/renderers/shared/fiber/ReactChildFiber.js @@ -123,6 +123,10 @@ function ChildReconciler(shouldClone) { switch (newChildren.$$typeof) { case REACT_ELEMENT_TYPE: { + /* $FlowFixMe(>=0.31.0): This is an unsafe cast. Consider adding a type + * annotation to the `newChildren` param of this + * function. + */ const element = (newChildren : ReactElement); if (existingChild && element.type === existingChild.type && @@ -144,6 +148,8 @@ function ChildReconciler(shouldClone) { } case REACT_COROUTINE_TYPE: { + /* $FlowFixMe(>=0.31.0): No 'handler' property found in object type + */ const coroutine = (newChildren : ReactCoroutine); const child = createFiberFromCoroutine(coroutine, priority); child.return = returnFiber; @@ -154,6 +160,9 @@ function ChildReconciler(shouldClone) { // A yield results in a fragment fiber whose output is the continuation. // TODO: When there is only a single child, we can optimize this to avoid // the fragment. + /* $FlowFixMe(>=0.31.0): No 'continuation' property found in object + * type + */ const yieldNode = (newChildren : ReactYield); const reifiedYield = createReifiedYield(yieldNode); const child = createFiberFromYield(yieldNode, priority); @@ -167,6 +176,11 @@ function ChildReconciler(shouldClone) { var first : ?Fiber = null; var prev : ?Fiber = null; var existing : ?Fiber = existingChild; + /* $FlowIssue(>=0.31.0) #12747709 + * + * `Array.isArray` is matched syntactically for now until predicate + * support is complete. + */ for (var i = 0; i < newChildren.length; i++) { var nextExisting = existing && existing.sibling; if (prev == null) { diff --git a/src/renderers/shared/fiber/isomorphic/ReactCoroutine.js b/src/renderers/shared/fiber/isomorphic/ReactCoroutine.js index 0218269a9e..dda4ca1fb3 100644 --- a/src/renderers/shared/fiber/isomorphic/ReactCoroutine.js +++ b/src/renderers/shared/fiber/isomorphic/ReactCoroutine.js @@ -33,6 +33,9 @@ export type ReactCoroutine = { children: any, // This should be a more specific CoroutineHandler handler: (props: any, yields: Array) => ReactNodeList, + /* $FlowFixMe(>=0.31.0): Which is it? mixed? Or Object? Must match + * `ReactYield` type. + */ props: mixed, }; export type ReactYield = {