Remove instanceof checks

Summary: Replaced `instanceof` checks with `isSandyPlugin` utility. That is cleaner to read and makes it easier to find places where we make exceptions for Sandy plugins

Reviewed By: jknoxville

Differential Revision: D22206707

fbshipit-source-id: b44a1b585424f3b9bf0d7ce200c34107f03ed55e
This commit is contained in:
Michel Weststrate
2020-07-01 08:58:40 -07:00
committed by Facebook GitHub Bot
parent 1dc9e899b8
commit 04a29315e2
11 changed files with 45 additions and 34 deletions

View File

@@ -37,6 +37,12 @@ export type ClientPluginDefinition =
export type ClientPluginMap = Map<string, ClientPluginDefinition>;
export type DevicePluginMap = Map<string, DevicePluginDefinition>;
export function isSandyPlugin(
plugin?: PluginDefinition,
): plugin is SandyPluginDefinition {
return plugin instanceof SandyPluginDefinition;
}
// This function is intended to be called from outside of the plugin.
// If you want to `call` from the plugin use, this.client.call
export function callClient(