Deal with 0.38 'FlowFixMe's

Summary:
Largely typing fixes to deal with the glut of new `FlowFixMe` suppressions introduced with flow 0.38 in a4bfac907e

Tested with flow itself. CC gabelevi
Closes https://github.com/facebook/react-native/pull/11985

Differential Revision: D4452045

Pulled By: ericvicenti

fbshipit-source-id: acc46c4c406ae706a679e396be1d40ae2f4ce5a1
This commit is contained in:
rh389 2017-01-31 13:00:12 -08:00 committed by Facebook Github Bot
parent 8378f0f9f7
commit 7a4166c31d
8 changed files with 17 additions and 58 deletions

View File

@ -47,7 +47,7 @@ const JSTimersExecution = {
requestIdleCallbacks: [],
identifiers: ([] : Array<null | {methodName: string}>),
errors: (null : ?[Error]),
errors: (null : ?Array<Error>),
/**
* Calls the callback associated with the ID. Also unregister that callback
@ -112,9 +112,6 @@ const JSTimersExecution = {
if (!JSTimersExecution.errors) {
JSTimersExecution.errors = [e];
} else {
/* $FlowFixMe(>=0.38.0 site=react_native_fb,react_native_oss) - Flow
* error detected during the deployment of v0.38.0. To see the error,
* remove this comment and run flow */
JSTimersExecution.errors.push(e);
}
}

View File

@ -19,6 +19,8 @@ const React = require('React');
const StyleSheet = require('StyleSheet');
const View = require('View');
const invariant = require('fbjs/lib/invariant');
import type {
NavigationAnimatedValue,
NavigationLayout,
@ -259,17 +261,17 @@ function buildTransitionProps(
scenes,
} = state;
/* $FlowFixMe(>=0.38.0 site=react_native_fb,react_native_oss) - Flow error
* detected during the deployment of v0.38.0. To see the error, remove this
* comment and run flow
*/
const scene = scenes.find(isSceneActive);
invariant(scene, 'No active scene when building navigation transition props.');
return {
layout,
navigationState,
position,
progress,
scenes,
scene: scenes.find(isSceneActive),
scene
};
}

View File

@ -121,7 +121,7 @@ class XMLHttpRequest extends EventTarget(...XHR_EVENTS) {
upload: XMLHttpRequestEventTarget = new XMLHttpRequestEventTarget();
_requestId: ?number;
_subscriptions: [any];
_subscriptions: Array<*>;
_aborted: boolean = false;
_cachedResponse: Response;
@ -393,9 +393,6 @@ class XMLHttpRequest extends EventTarget(...XHR_EVENTS) {
(this._subscriptions || []).forEach(sub => {
sub.remove();
});
/* $FlowFixMe(>=0.38.0 site=react_native_fb,react_native_oss) - Flow error
* detected during the deployment of v0.38.0. To see the error, remove this
* comment and run flow */
this._subscriptions = [];
}
@ -460,44 +457,26 @@ class XMLHttpRequest extends EventTarget(...XHR_EVENTS) {
!!this.onreadystatechange ||
!!this.onprogress;
/* $FlowFixMe(>=0.38.0 site=react_native_fb,react_native_oss) - Flow error
* detected during the deployment of v0.38.0. To see the error, remove this
* comment and run flow */
this._subscriptions.push(RCTNetworking.addListener(
'didSendNetworkData',
(args) => this.__didUploadProgress(...args)
));
/* $FlowFixMe(>=0.38.0 site=react_native_fb,react_native_oss) - Flow error
* detected during the deployment of v0.38.0. To see the error, remove this
* comment and run flow */
this._subscriptions.push(RCTNetworking.addListener(
'didReceiveNetworkResponse',
(args) => this.__didReceiveResponse(...args)
));
/* $FlowFixMe(>=0.38.0 site=react_native_fb,react_native_oss) - Flow error
* detected during the deployment of v0.38.0. To see the error, remove this
* comment and run flow */
this._subscriptions.push(RCTNetworking.addListener(
'didReceiveNetworkData',
(args) => this.__didReceiveData(...args)
));
/* $FlowFixMe(>=0.38.0 site=react_native_fb,react_native_oss) - Flow error
* detected during the deployment of v0.38.0. To see the error, remove this
* comment and run flow */
this._subscriptions.push(RCTNetworking.addListener(
'didReceiveNetworkIncrementalData',
(args) => this.__didReceiveIncrementalData(...args)
));
/* $FlowFixMe(>=0.38.0 site=react_native_fb,react_native_oss) - Flow error
* detected during the deployment of v0.38.0. To see the error, remove this
* comment and run flow */
this._subscriptions.push(RCTNetworking.addListener(
'didReceiveNetworkDataProgress',
(args) => this.__didReceiveDataProgress(...args)
));
/* $FlowFixMe(>=0.38.0 site=react_native_fb,react_native_oss) - Flow error
* detected during the deployment of v0.38.0. To see the error, remove this
* comment and run flow */
this._subscriptions.push(RCTNetworking.addListener(
'didCompleteNetworkResponse',
(args) => this.__didCompleteResponse(...args)

View File

@ -111,11 +111,7 @@ const TypeToDifferMap = {
// (not yet implemented)
};
function processColorArray(colors: []): [] {
/* $FlowFixMe(>=0.38.0 site=react_native_fb,react_native_oss) - Flow error
* detected during the deployment of v0.38.0. To see the error, remove this
* comment and run flow
*/
function processColorArray(colors: ?Array<any>): ?Array<?number> {
return colors && colors.map(processColor);
}

View File

@ -73,7 +73,6 @@ function ChildReconciler(shouldClone) {
return clone;
}
const child = createFiberFromElement(element, priority);
// $FlowFixMe(>=0.34.0)
previousSibling.sibling = child;
child.return = returnFiber;
return child;

View File

@ -57,9 +57,6 @@ type Instance = {
// A Fiber is work on a Component that needs to be done or was done. There can
// be more than one per component.
/* $FlowFixMe(>=0.38.0 site=react_native_fb,react_native_oss) - Flow error
* detected during the deployment of v0.38.0. To see the error, remove this
* comment and run flow */
export type Fiber = Instance & {
// The Fiber to return to after finishing processing this one.
@ -249,7 +246,7 @@ exports.createFiberFromElement = function(element : ReactElement<*>, priorityLev
};
// $FlowFixMe(>=0.34.0)
function createFiberFromElementType(type : mixed, key : null | string) {
function createFiberFromElementType(type : Function | string | Fiber, key : null | string) {
let fiber;
if (typeof type === 'function') {
fiber = shouldConstruct(type) ?

View File

@ -20,16 +20,11 @@ var { createFiberFromElementType } = require('ReactFiber');
export type ReifiedYield = { continuation: Fiber, props: Object };
exports.createReifiedYield = function(yieldNode : ReactYield) : ReifiedYield {
var fiber = createFiberFromElementType(
yieldNode.continuation,
yieldNode.key
);
/* $FlowFixMe(>=0.38.0 site=react_native_fb,react_native_oss) - Flow error
* detected during the deployment of v0.38.0. To see the error, remove this
* comment and run flow
*/
return {
continuation: fiber,
continuation: createFiberFromElementType(
yieldNode.continuation,
yieldNode.key
),
props: yieldNode.props,
};
};

View File

@ -47,10 +47,7 @@ export default class AggrowTable extends React.Component {
state: State;
componentDidMount() {
/* $FlowFixMe(>=0.38.0 site=react_native_fb,react_native_oss) - Flow error
* detected during the deployment of v0.38.0. To see the error, remove this
* comment and run flow */
document.body.addEventListener('keydown', this.keydown);
document.body && document.body.addEventListener('keydown', this.keydown);
}
componentWillReceiveProps(nextProps: Props) {
@ -64,10 +61,7 @@ export default class AggrowTable extends React.Component {
}
componentWillUnmount() {
/* $FlowFixMe(>=0.38.0 site=react_native_fb,react_native_oss) - Flow error
* detected during the deployment of v0.38.0. To see the error, remove this
* comment and run flow */
document.body.removeEventListener('keydown', this.keydown);
document.body && document.body.removeEventListener('keydown', this.keydown);
}
scroll = (e: SyntheticUIEvent) => {