Skip to content

Commit 1ce4d3d

Browse files
authored
refactor(sdk): use ReturnType for Timeout types (#1637)
1 parent 3eb3e31 commit 1ce4d3d

17 files changed

+32
-65
lines changed

sdk/bun.lock

Lines changed: 15 additions & 48 deletions
Large diffs are not rendered by default.

sdk/src/accounts/webSocketAccountSubscriber.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class WebSocketAccountSubscriber<T> implements AccountSubscriber<T> {
2424
commitment?: Commitment;
2525
isUnsubscribing = false;
2626

27-
timeoutId?: NodeJS.Timeout;
27+
timeoutId?: ReturnType<typeof setTimeout>;
2828

2929
receivingData: boolean;
3030

sdk/src/accounts/webSocketProgramAccountSubscriber.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class WebSocketProgramAccountSubscriber<T>
2727
listenerId?: number;
2828
resubOpts?: ResubOpts;
2929
isUnsubscribing = false;
30-
timeoutId?: NodeJS.Timeout;
30+
timeoutId?: ReturnType<typeof setTimeout>;
3131
options: { filters: MemcmpFilter[]; commitment?: Commitment };
3232

3333
receivingData = false;

sdk/src/blockhashSubscriber/BlockhashSubscriber.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class BlockhashSubscriber {
1212
private latestBlockHeight: number;
1313
private latestBlockHeightContext: Context | undefined;
1414
private blockhashes: Array<BlockhashWithExpiryBlockHeight> = [];
15-
private updateBlockhashIntervalId: NodeJS.Timeout | undefined;
15+
private updateBlockhashIntervalId: ReturnType<typeof setTimeout> | undefined;
1616
private commitment: Commitment;
1717
private updateIntervalMs: number;
1818

sdk/src/clock/clockSubscriber.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class ClockSubscriber {
2929
}
3030

3131
// Reconnection
32-
private timeoutId?: NodeJS.Timeout;
32+
private timeoutId?: ReturnType<typeof setTimeout>;
3333
private resubTimeoutMs?: number;
3434
private isUnsubscribing = false;
3535
private receivingData = false;

sdk/src/dlob/DLOBSubscriber.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class DLOBSubscriber {
2424
dlobSource: DLOBSource;
2525
slotSource: SlotSource;
2626
updateFrequency: number;
27-
intervalId?: NodeJS.Timeout;
27+
intervalId?: ReturnType<typeof setTimeout>;
2828
dlob: DLOB;
2929
public eventEmitter: StrictEventEmitter<EventEmitter, DLOBSubscriberEvents>;
3030
protectedMakerView: boolean;

sdk/src/events/eventsServerLogProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class EventsServerLogProvider implements LogProvider {
1919
private isUnsubscribing = false;
2020
private externalUnsubscribe = false;
2121
private lastHeartbeat = 0;
22-
private timeoutId?: NodeJS.Timeout;
22+
private timeoutId?: ReturnType<typeof setTimeout>;
2323
private reconnectAttempts = 0;
2424
eventEmitter?: EventEmitter;
2525

sdk/src/events/webSocketLogProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class WebSocketLogProvider implements LogProvider {
1313
private isUnsubscribing = false;
1414
private externalUnsubscribe = false;
1515
private receivingData = false;
16-
private timeoutId?: NodeJS.Timeout;
16+
private timeoutId?: ReturnType<typeof setTimeout>;
1717
private reconnectAttempts = 0;
1818
eventEmitter?: EventEmitter;
1919
private callback?: logProviderCallback;

sdk/src/indicative-quotes/indicativeQuotesSender.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ type Quote = {
1717
};
1818

1919
export class IndicativeQuotesSender {
20-
private heartbeatTimeout: NodeJS.Timeout | null = null;
21-
private sendQuotesInterval: NodeJS.Timeout | null = null;
20+
private heartbeatTimeout: ReturnType<typeof setTimeout> | null = null;
21+
private sendQuotesInterval: ReturnType<typeof setTimeout> | null = null;
2222

2323
private readonly heartbeatIntervalMs = 60000;
2424
private reconnectDelay = 1000;

sdk/src/orderSubscriber/WebsocketSubscription.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class WebsocketSubscription {
1313
private resyncIntervalMs?: number;
1414

1515
private subscriber?: WebSocketProgramAccountSubscriber<UserAccount>;
16-
private resyncTimeoutId?: NodeJS.Timeout;
16+
private resyncTimeoutId?: ReturnType<typeof setTimeout>;
1717

1818
private decoded?: boolean;
1919

0 commit comments

Comments
 (0)