diff --git a/lib/reactotron-core-client/src/client-options.ts b/lib/reactotron-core-client/src/client-options.ts index 67d435be3..a74d33ec4 100644 --- a/lib/reactotron-core-client/src/client-options.ts +++ b/lib/reactotron-core-client/src/client-options.ts @@ -6,24 +6,24 @@ type BrowserWebSocket = WebSocket /** * Configuration options for the Reactotron Client. */ -export interface ClientOptions extends LifeCycleMethods { +export interface ClientOptions extends Omit { /** * A function which returns a websocket. * * This is over-engineered because we need the ability to create different * types of websockets for React Native, React, and NodeJS. :| */ - createSocket?: ((path: string) => BrowserWebSocket) | ((path: string) => NodeWebSocket) + createSocket?: ((path: string) => BrowserWebSocket) | ((path: string) => NodeWebSocket) | null /** * The hostname or ip address of the server. Default: localhost. */ - host?: string + host?: string | null /** * The port to connect to the server on. Default: 9090. */ - port?: number + port?: number | null /** * The name of this client. Usually the app name. @@ -55,7 +55,7 @@ export interface ClientOptions extends LifeCycleMethods { /** * Fires when the server sends a command. */ - onCommand?: (command: any) => void + onCommand?: ((command: any) => void) | null /** * Fires when we connect to the server. diff --git a/lib/reactotron-core-client/test/configure.test.ts b/lib/reactotron-core-client/test/configure.test.ts index d134ff52d..e0dd1f2a9 100644 --- a/lib/reactotron-core-client/test/configure.test.ts +++ b/lib/reactotron-core-client/test/configure.test.ts @@ -1,5 +1,5 @@ import { createClient } from "../src/reactotron-core-client" -import WebSocket from "ws" +import { WebSocket } from "ws" const createSocket = (path) => new WebSocket(path) diff --git a/lib/reactotron-core-client/test/plugin-clear.test.ts b/lib/reactotron-core-client/test/plugin-clear.test.ts index 7f0b59e42..7156b7c3e 100644 --- a/lib/reactotron-core-client/test/plugin-clear.test.ts +++ b/lib/reactotron-core-client/test/plugin-clear.test.ts @@ -1,12 +1,12 @@ import { createClient, corePlugins } from "../src/reactotron-core-client" import plugin from "../src/plugins/clear" -import WebSocket from "ws" +import { WebSocket } from "ws" const createSocket = (path) => new WebSocket(path) test("clears", () => { const client: any = createClient({ createSocket }) - const results = [] + const results = [] as Array<{ type: string; payload: any }> client.send = (type, payload) => results.push({ type, payload }) client.use(plugin()) expect(client.plugins.length).toBe(corePlugins.length + 1) diff --git a/lib/reactotron-core-client/test/plugin-logger.test.ts b/lib/reactotron-core-client/test/plugin-logger.test.ts index c5f4b0597..5291c4813 100644 --- a/lib/reactotron-core-client/test/plugin-logger.test.ts +++ b/lib/reactotron-core-client/test/plugin-logger.test.ts @@ -1,12 +1,12 @@ import { createClient, corePlugins } from "../src/reactotron-core-client" import plugin from "../src/plugins/logger" -import WebSocket from "ws" +import { WebSocket } from "ws" const createSocket = (path) => new WebSocket(path) test("the 4 functions send the right data", () => { const client: any = createClient({ createSocket }) - const results = [] + const results = [] as Array<{ type: string; payload: any }> client.send = (type, payload) => { results.push({ type, payload }) }