Client fixes

Summary:
Event emitter was typed any. Therefore, Client extended any and thing went south.
removing the explicit any type and fixing flow errors.

Reviewed By: jknoxville

Differential Revision: D15987630

fbshipit-source-id: 9456149d46f839d9579fcc2671ab2a82935fc23a
This commit is contained in:
Daniel Büchele
2019-07-01 02:32:12 -07:00
committed by Facebook Github Bot
parent 1a0ee24b1a
commit 468468a3bc
3 changed files with 7 additions and 7 deletions

View File

@@ -22,7 +22,7 @@ import {default as isProduction} from './utils/isProduction.js';
import {registerPlugins} from './reducers/plugins';
import createTableNativePlugin from './plugins/TableNativePlugin';
const EventEmitter = (require('events'): any);
const EventEmitter = require('events');
const invariant = require('invariant');
type Plugins = Array<string>;
@@ -196,9 +196,6 @@ export default class Client extends EventEmitter {
);
}
on: ((event: 'plugins-change', callback: () => void) => void) &
((event: 'close', callback: () => void) => void);
app: App;
connected: boolean;
id: string;
@@ -211,7 +208,8 @@ export default class Client extends EventEmitter {
store: Store;
activePlugins: Set<string>;
device: Promise<BaseDevice>;
logger: Logger;
lastSeenDeviceList: Array<BaseDevice>;
broadcastCallbacks: Map<?string, Map<string, Set<Function>>>;
requestCallbacks: Map<

View File

@@ -11,6 +11,7 @@ import {performance} from 'perf_hooks';
import type {Store} from '../reducers/index.js';
import type {Logger} from '../fb-interfaces/Logger.js';
import type Client from '../Client';
export default (store: Store, logger: Logger) => {
let droppedFrames: number = 0;

View File

@@ -156,6 +156,7 @@ export class FlipperDevicePlugin<S = *, A = *, P = *> extends FlipperBasePlugin<
constructor(props: Props<P>) {
super(props);
// $FlowFixMe props.target will be instance of Device
this.device = props.target;
}
@@ -203,8 +204,8 @@ export class FlipperPlugin<S = *, A = *, P = *> extends FlipperBasePlugin<
client: PluginClient;
realClient: Client;
getDevice(): ?BaseDevice {
return this.realClient.getDevice();
getDevice(): Promise<BaseDevice> {
return this.realClient.device;
}
getAndroidDevice(): AndroidDevice {