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: [], requestIdleCallbacks: [],
identifiers: ([] : Array<null | {methodName: string}>), identifiers: ([] : Array<null | {methodName: string}>),
errors: (null : ?[Error]), errors: (null : ?Array<Error>),
/** /**
* Calls the callback associated with the ID. Also unregister that callback * Calls the callback associated with the ID. Also unregister that callback
@ -112,9 +112,6 @@ const JSTimersExecution = {
if (!JSTimersExecution.errors) { if (!JSTimersExecution.errors) {
JSTimersExecution.errors = [e]; JSTimersExecution.errors = [e];
} else { } 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); JSTimersExecution.errors.push(e);
} }
} }

View File

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

View File

@ -121,7 +121,7 @@ class XMLHttpRequest extends EventTarget(...XHR_EVENTS) {
upload: XMLHttpRequestEventTarget = new XMLHttpRequestEventTarget(); upload: XMLHttpRequestEventTarget = new XMLHttpRequestEventTarget();
_requestId: ?number; _requestId: ?number;
_subscriptions: [any]; _subscriptions: Array<*>;
_aborted: boolean = false; _aborted: boolean = false;
_cachedResponse: Response; _cachedResponse: Response;
@ -393,9 +393,6 @@ class XMLHttpRequest extends EventTarget(...XHR_EVENTS) {
(this._subscriptions || []).forEach(sub => { (this._subscriptions || []).forEach(sub => {
sub.remove(); 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 = []; this._subscriptions = [];
} }
@ -460,44 +457,26 @@ class XMLHttpRequest extends EventTarget(...XHR_EVENTS) {
!!this.onreadystatechange || !!this.onreadystatechange ||
!!this.onprogress; !!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( this._subscriptions.push(RCTNetworking.addListener(
'didSendNetworkData', 'didSendNetworkData',
(args) => this.__didUploadProgress(...args) (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( this._subscriptions.push(RCTNetworking.addListener(
'didReceiveNetworkResponse', 'didReceiveNetworkResponse',
(args) => this.__didReceiveResponse(...args) (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( this._subscriptions.push(RCTNetworking.addListener(
'didReceiveNetworkData', 'didReceiveNetworkData',
(args) => this.__didReceiveData(...args) (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( this._subscriptions.push(RCTNetworking.addListener(
'didReceiveNetworkIncrementalData', 'didReceiveNetworkIncrementalData',
(args) => this.__didReceiveIncrementalData(...args) (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( this._subscriptions.push(RCTNetworking.addListener(
'didReceiveNetworkDataProgress', 'didReceiveNetworkDataProgress',
(args) => this.__didReceiveDataProgress(...args) (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( this._subscriptions.push(RCTNetworking.addListener(
'didCompleteNetworkResponse', 'didCompleteNetworkResponse',
(args) => this.__didCompleteResponse(...args) (args) => this.__didCompleteResponse(...args)

View File

@ -111,11 +111,7 @@ const TypeToDifferMap = {
// (not yet implemented) // (not yet implemented)
}; };
function processColorArray(colors: []): [] { function processColorArray(colors: ?Array<any>): ?Array<?number> {
/* $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 colors && colors.map(processColor); return colors && colors.map(processColor);
} }

View File

@ -73,7 +73,6 @@ function ChildReconciler(shouldClone) {
return clone; return clone;
} }
const child = createFiberFromElement(element, priority); const child = createFiberFromElement(element, priority);
// $FlowFixMe(>=0.34.0)
previousSibling.sibling = child; previousSibling.sibling = child;
child.return = returnFiber; child.return = returnFiber;
return child; 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 // A Fiber is work on a Component that needs to be done or was done. There can
// be more than one per component. // 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 & { export type Fiber = Instance & {
// The Fiber to return to after finishing processing this one. // The Fiber to return to after finishing processing this one.
@ -249,7 +246,7 @@ exports.createFiberFromElement = function(element : ReactElement<*>, priorityLev
}; };
// $FlowFixMe(>=0.34.0) // $FlowFixMe(>=0.34.0)
function createFiberFromElementType(type : mixed, key : null | string) { function createFiberFromElementType(type : Function | string | Fiber, key : null | string) {
let fiber; let fiber;
if (typeof type === 'function') { if (typeof type === 'function') {
fiber = shouldConstruct(type) ? fiber = shouldConstruct(type) ?

View File

@ -20,16 +20,11 @@ var { createFiberFromElementType } = require('ReactFiber');
export type ReifiedYield = { continuation: Fiber, props: Object }; export type ReifiedYield = { continuation: Fiber, props: Object };
exports.createReifiedYield = function(yieldNode : ReactYield) : ReifiedYield { 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 { return {
continuation: fiber, continuation: createFiberFromElementType(
yieldNode.continuation,
yieldNode.key
),
props: yieldNode.props, props: yieldNode.props,
}; };
}; };

View File

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