From 468468a3bc3ea34fd0498f93da38af185296d0be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Mon, 1 Jul 2019 02:32:12 -0700 Subject: [PATCH] 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 --- src/Client.js | 8 +++----- src/dispatcher/tracking.js | 1 + src/plugin.js | 5 +++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Client.js b/src/Client.js index 5950a537c..225b4f764 100644 --- a/src/Client.js +++ b/src/Client.js @@ -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; @@ -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; device: Promise; - + logger: Logger; + lastSeenDeviceList: Array; broadcastCallbacks: Map>>; requestCallbacks: Map< diff --git a/src/dispatcher/tracking.js b/src/dispatcher/tracking.js index 75121569d..9ddae8857 100644 --- a/src/dispatcher/tracking.js +++ b/src/dispatcher/tracking.js @@ -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; diff --git a/src/plugin.js b/src/plugin.js index f36ce17a1..db250e8aa 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -156,6 +156,7 @@ export class FlipperDevicePlugin extends FlipperBasePlugin< constructor(props: Props

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