Adjust NodeJS.Timout type usage (#5026)

This commit is contained in:
Jaco
2022-07-04 16:15:50 +03:00
committed by GitHub
parent 637cc089fe
commit 75bbd042a9
4 changed files with 19 additions and 6 deletions
+4 -2
View File
@@ -44,7 +44,8 @@ export class MockProvider implements ProviderInterface {
private emitter = new EventEmitter();
private intervalId?: NodeJS.Timeout | null;
// Browser/Deno = number, Node = Timeout
private intervalId?: unknown | null;
public isUpdating = true;
@@ -109,7 +110,8 @@ export class MockProvider implements ProviderInterface {
// eslint-disable-next-line @typescript-eslint/require-await
public async disconnect (): Promise<void> {
if (this.intervalId) {
clearInterval(this.intervalId);
// different method signatures for Node vs Browser/Deno
clearInterval(this.intervalId as number);
this.intervalId = null;
}
}
+4 -2
View File
@@ -106,7 +106,8 @@ export class WsProvider implements ProviderInterface {
#subscriptions: Record<string, WsStateSubscription> = {};
#timeoutId?: NodeJS.Timeout | null = null;
// Browser/Deno = number, Node = Timeout
#timeoutId?: unknown | null = null;
#websocket: WebSocket | null;
@@ -426,7 +427,8 @@ export class WsProvider implements ProviderInterface {
}
if (this.#timeoutId) {
clearInterval(this.#timeoutId);
// different method signatures for Node vs Browser/Deno
clearInterval(this.#timeoutId as number);
this.#timeoutId = null;
}