fix new flow errors after D3561327
Reviewed By: bestander Differential Revision: D3561376 fbshipit-source-id: 226f0d1c6a771a987f9e04f114dc3ba1cca531b1
This commit is contained in:
parent
f5ba1693fe
commit
9bfa393a79
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var invariant = require('fbjs/lib/invariant');
|
||||
const invariant = require('fbjs/lib/invariant');
|
||||
|
||||
class NavigationEventPool {
|
||||
_list: Array<any>;
|
||||
|
@ -37,7 +37,7 @@ class NavigationEventPool {
|
|||
}
|
||||
|
||||
get(type: string, currentTarget: Object, data: any): NavigationEvent {
|
||||
var event;
|
||||
let event;
|
||||
if (this._list.length > 0) {
|
||||
event = this._list.pop();
|
||||
event.constructor.call(event, type, currentTarget, data);
|
||||
|
@ -52,7 +52,7 @@ class NavigationEventPool {
|
|||
}
|
||||
}
|
||||
|
||||
var _navigationEventPool = new NavigationEventPool();
|
||||
const _navigationEventPool = new NavigationEventPool();
|
||||
|
||||
/**
|
||||
* The NavigationEvent interface represents any event of the navigation.
|
||||
|
@ -87,7 +87,7 @@ class NavigationEvent {
|
|||
_defaultPrevented: boolean;
|
||||
_disposed: boolean;
|
||||
_propagationStopped: boolean;
|
||||
_type: ?string;
|
||||
_type: string;
|
||||
|
||||
target: ?Object;
|
||||
|
||||
|
@ -111,22 +111,18 @@ class NavigationEvent {
|
|||
this._propagationStopped = false;
|
||||
}
|
||||
|
||||
/* $FlowFixMe - get/set properties not yet supported */
|
||||
get type(): string {
|
||||
return this._type;
|
||||
}
|
||||
|
||||
/* $FlowFixMe - get/set properties not yet supported */
|
||||
get currentTarget(): Object {
|
||||
get currentTarget(): ?Object {
|
||||
return this._currentTarget;
|
||||
}
|
||||
|
||||
/* $FlowFixMe - get/set properties not yet supported */
|
||||
get data(): any {
|
||||
return this._data;
|
||||
}
|
||||
|
||||
/* $FlowFixMe - get/set properties not yet supported */
|
||||
get defaultPrevented(): boolean {
|
||||
return this._defaultPrevented;
|
||||
}
|
||||
|
@ -160,7 +156,7 @@ class NavigationEvent {
|
|||
// Clean up.
|
||||
this.target = null;
|
||||
this.eventPhase = NavigationEvent.NONE;
|
||||
this._type = null;
|
||||
this._type = '';
|
||||
this._currentTarget = null;
|
||||
this._data = null;
|
||||
this._defaultPrevented = false;
|
||||
|
|
|
@ -61,12 +61,10 @@ class RouteStack {
|
|||
this._index = index;
|
||||
}
|
||||
|
||||
/* $FlowFixMe - get/set properties not yet supported */
|
||||
get size(): number {
|
||||
return this._routeNodes.size;
|
||||
}
|
||||
|
||||
/* $FlowFixMe - get/set properties not yet supported */
|
||||
get index(): number {
|
||||
return this._index;
|
||||
}
|
||||
|
|
|
@ -134,12 +134,10 @@ class XMLHttpRequest extends EventTarget(...XHR_EVENTS) {
|
|||
this._timedOut = false;
|
||||
}
|
||||
|
||||
// $FlowIssue #10784535
|
||||
get responseType(): ResponseType {
|
||||
return this._responseType;
|
||||
}
|
||||
|
||||
// $FlowIssue #10784535
|
||||
set responseType(responseType: ResponseType): void {
|
||||
if (this._sent) {
|
||||
throw new Error(
|
||||
|
@ -163,11 +161,10 @@ class XMLHttpRequest extends EventTarget(...XHR_EVENTS) {
|
|||
this._responseType = responseType;
|
||||
}
|
||||
|
||||
// $FlowIssue #10784535
|
||||
get responseText(): string {
|
||||
if (this._responseType !== '' && this._responseType !== 'text') {
|
||||
throw new Error(
|
||||
`The 'responseText' property is only available if 'responseType' ` +
|
||||
"The 'responseText' property is only available if 'responseType' " +
|
||||
`is set to '' or 'text', but it is '${this._responseType}'.`
|
||||
);
|
||||
}
|
||||
|
@ -177,7 +174,6 @@ class XMLHttpRequest extends EventTarget(...XHR_EVENTS) {
|
|||
return this._response;
|
||||
}
|
||||
|
||||
// $FlowIssue #10784535
|
||||
get response(): Response {
|
||||
const {responseType} = this;
|
||||
if (responseType === '' || responseType === 'text') {
|
||||
|
|
Loading…
Reference in New Issue