Permalink
Browse files

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 a4bfac9

Tested with flow itself. CC gabelevi
Closes #11985

Differential Revision: D4452045

Pulled By: ericvicenti

fbshipit-source-id: acc46c4c406ae706a679e396be1d40ae2f4ce5a1
  • Loading branch information...
rh389 authored and facebook-github-bot committed Jan 31, 2017
1 parent 8378f0f commit 7a4166c31d58dd74678e0b2b6299245db8071aa8
@@ -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);
}
}
@@ -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
};
}
@@ -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)
@@ -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);
}
@@ -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;
@@ -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) ?
@@ -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,
};
};
@@ -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) => {

0 comments on commit 7a4166c

Please sign in to comment.