From 8d7e4e01317ea62ddacb4544ce6b1bdf25f91cae Mon Sep 17 00:00:00 2001 From: nico <16513382+117@users.noreply.github.com> Date: Sun, 9 Jun 2024 14:00:00 -0400 Subject: [PATCH] use Nullable --- factory/createStream.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/factory/createStream.ts b/factory/createStream.ts index 449982a..843b1b3 100644 --- a/factory/createStream.ts +++ b/factory/createStream.ts @@ -1,5 +1,7 @@ // NOT CLEANED UP; TYPES MISSING FOR CALLBACKS +import { Nullable } from "../api/trade.ts"; + const baseURLs = { data: "wss://stream.data.alpaca.markets", data_sandbox: "wss://stream.data.sandbox.alpaca.markets", @@ -53,7 +55,7 @@ export const createStream = (options: CreateStreamOptions): void => { url = `${baseURLs[type]}/stream`; } - let socket: WebSocket | null = null; + let socket: Nullable = null; let retries = 0; // Handle incoming messages @@ -75,7 +77,7 @@ export const createStream = (options: CreateStreamOptions): void => { socket.onopen = () => { console.debug( - "WebSocket connection established. Sending authentication message." + "WebSocket connection established. Sending authentication message.", ); socket?.send( @@ -83,7 +85,7 @@ export const createStream = (options: CreateStreamOptions): void => { action: "auth", key: key, secret: secret, - }) + }), ); };