Skip to content

Commit 9bfa45b

Browse files
authored
Update Flow and fix issues (#8006)
1 parent 7536767 commit 9bfa45b

File tree

9 files changed

+25
-22
lines changed

9 files changed

+25
-22
lines changed

.flowconfig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
[include]
1414

1515
[libs]
16-
./node_modules/fbjs/flow/lib
16+
./node_modules/fbjs/flow/lib/dev.js
1717
./flow
1818

1919
[options]
@@ -29,10 +29,10 @@ suppress_type=$FlowFixMe
2929
suppress_type=$FixMe
3030
suppress_type=$FlowExpectedError
3131

32-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-1]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)
33-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-1]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)?:? #[0-9]+
32+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-3]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)
33+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-3]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)?:? #[0-9]+
3434
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
3535
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
3636

3737
[version]
38-
^0.31.0
38+
^0.33.0

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
"eslint": "1.10.3",
4444
"eslint-plugin-react": "4.1.0",
4545
"eslint-plugin-react-internal": "file:eslint-rules",
46-
"fbjs": "^0.8.4",
46+
"fbjs": "^0.8.5",
4747
"fbjs-scripts": "^0.6.0",
48-
"flow-bin": "^0.31.0",
48+
"flow-bin": "^0.33.0",
4949
"glob": "^6.0.1",
5050
"grunt": "^0.4.5",
5151
"grunt-cli": "^0.1.13",

src/renderers/dom/fiber/ReactDOMFiber.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ var DOMRenderer = ReactFiberReconciler({
5454
createInstance(type : string, props : Props, children : HostChildren<Instance | TextInstance>) : Instance {
5555
const domElement = document.createElement(type);
5656
recursivelyAppendChildren(domElement, children);
57-
if (typeof props.children === 'string' ||
58-
typeof props.children === 'number') {
57+
if (typeof props.children === 'string') {
5958
domElement.textContent = props.children;
59+
} else if (typeof props.children === 'number') {
60+
domElement.textContent = props.children.toString();
6061
}
6162
return domElement;
6263
},
@@ -70,9 +71,10 @@ var DOMRenderer = ReactFiberReconciler({
7071
},
7172

7273
commitUpdate(domElement : Instance, oldProps : Props, newProps : Props) : void {
73-
if (typeof newProps.children === 'string' ||
74-
typeof newProps.children === 'number') {
74+
if (typeof newProps.children === 'string') {
7575
domElement.textContent = newProps.children;
76+
} else if (typeof newProps.children === 'number') {
77+
domElement.textContent = newProps.children.toString();
7678
}
7779
},
7880

src/renderers/native/NativeMethodsMixin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ function mountSafeCallback(
212212
callback: ?Function
213213
): any {
214214
return function() {
215-
if (!callback || (context.isMounted && !context.isMounted())) {
215+
if (!callback || (typeof context.isMounted === 'function' && !context.isMounted())) {
216216
return undefined;
217217
}
218218
return callback.apply(context, arguments);

src/renderers/shared/ReactDebugTool.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ function resumeCurrentLifeCycleTimer() {
239239

240240
var lastMarkTimeStamp = 0;
241241
var canUsePerformanceMeasure: boolean =
242-
// $FlowFixMe https://github.com/facebook/flow/issues/2345
243242
typeof performance !== 'undefined' &&
244243
typeof performance.mark === 'function' &&
245244
typeof performance.clearMarks === 'function' &&

src/renderers/shared/fiber/ReactFiberBeginWork.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>, s
369369
// next one immediately.
370370
return workInProgress.child;
371371
case HostComponent:
372-
if (workInProgress.stateNode && config.beginUpdate) {
372+
if (workInProgress.stateNode && typeof config.beginUpdate === 'function') {
373373
config.beginUpdate(workInProgress.stateNode);
374374
}
375375
return updateHostComponent(current, workInProgress);

src/renderers/shared/stack/reconciler/ReactInstanceType.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,27 @@
1212

1313
'use strict';
1414

15+
import type {ReactElement} from 'ReactElementType';
16+
1517
export type DebugID = number;
1618

1719
export type ReactInstance = {
18-
// ReactCompositeComponent
20+
// Shared
1921
mountComponent: any,
22+
unmountComponent: any,
23+
receiveComponent: any,
24+
getName: () => string,
25+
getPublicInstance: any,
26+
_currentElement: ReactElement,
27+
28+
// ReactCompositeComponent
2029
performInitialMountWithErrorHandling: any,
2130
performInitialMount: any,
2231
getHostNode: any,
23-
unmountComponent: any,
24-
receiveComponent: any,
2532
performUpdateIfNecessary: any,
2633
updateComponent: any,
2734
attachRef: (ref: string, component: ReactInstance) => void,
2835
detachRef: (ref: string) => void,
29-
getName: () => string,
30-
getPublicInstance: any,
3136
_rootNodeID: number,
3237

3338
// ReactDOMComponent

src/renderers/shared/utils/ReactErrorUtils.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ if (__DEV__) {
7777
var evtType = `react-${name}`;
7878
fakeNode.addEventListener(evtType, boundFunc, false);
7979
var evt = document.createEvent('Event');
80-
// $FlowFixMe https://github.com/facebook/flow/issues/2336
8180
evt.initEvent(evtType, false, false);
8281
fakeNode.dispatchEvent(evt);
8382
fakeNode.removeEventListener(evtType, boundFunc, false);

src/renderers/testing/ReactTestMount.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ var getHostComponentFromComposite = require('getHostComponentFromComposite');
2020
var instantiateReactComponent = require('instantiateReactComponent');
2121
var invariant = require('invariant');
2222

23-
import type { ReactElement } from 'ReactElementType';
24-
2523
export type TestRendererOptions = {
26-
createNodeMock: (element: ReactElement) => any,
24+
createNodeMock: (element: ReactElement<any>) => any,
2725
};
2826

2927
var defaultTestOptions = {

0 commit comments

Comments
 (0)