Use ReturnType<typeof setInterval> for timerIds (#5060)

* Use ReturnType<typeof setInterval> for timerIds

* Remove as number casts for clearInterval
This commit is contained in:
Jaco
2022-07-12 08:31:50 +03:00
committed by GitHub
parent 2548601c9f
commit aa5cc1eef1
3 changed files with 6 additions and 12 deletions
+2 -4
View File
@@ -106,8 +106,7 @@ export class WsProvider implements ProviderInterface {
#subscriptions: Record<string, WsStateSubscription> = {};
// Browser/Deno = number, Node = Timeout
#timeoutId?: unknown | null = null;
#timeoutId?: ReturnType<typeof setInterval> | null = null;
#websocket: WebSocket | null;
@@ -431,8 +430,7 @@ export class WsProvider implements ProviderInterface {
}
if (this.#timeoutId) {
// different method signatures for Node vs Browser/Deno
clearInterval(this.#timeoutId as number);
clearInterval(this.#timeoutId);
this.#timeoutId = null;
}