mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
fix: setTimeout and friends have too strict types (#5412)
This commit is contained in:
parent
ce57a1824d
commit
8440d765d5
3 changed files with 10 additions and 7 deletions
8
cli/js/lib.deno.shared_globals.d.ts
vendored
8
cli/js/lib.deno.shared_globals.d.ts
vendored
|
@ -176,16 +176,16 @@ declare namespace WebAssembly {
|
|||
|
||||
/** Sets a timer which executes a function once after the timer expires. */
|
||||
declare function setTimeout(
|
||||
cb: (...args: unknown[]) => void,
|
||||
cb: (...args: any[]) => void,
|
||||
delay?: number,
|
||||
...args: unknown[]
|
||||
...args: any[]
|
||||
): number;
|
||||
|
||||
/** Repeatedly calls a function , with a fixed time delay between each call. */
|
||||
declare function setInterval(
|
||||
cb: (...args: unknown[]) => void,
|
||||
cb: (...args: any[]) => void,
|
||||
delay?: number,
|
||||
...args: unknown[]
|
||||
...args: any[]
|
||||
): number;
|
||||
declare function clearTimeout(id?: number): void;
|
||||
declare function clearInterval(id?: number): void;
|
||||
|
|
|
@ -179,7 +179,8 @@ function fire(timer: Timer): void {
|
|||
callback();
|
||||
}
|
||||
|
||||
export type Args = unknown[];
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export type Args = any[];
|
||||
|
||||
function checkThis(thisArg: unknown): void {
|
||||
if (thisArg !== null && thisArg !== undefined && thisArg !== globalThis) {
|
||||
|
|
|
@ -5,7 +5,9 @@ export const clearTimeout = window.clearTimeout;
|
|||
export const setInterval = window.setInterval;
|
||||
export const clearInterval = window.clearInterval;
|
||||
export const setImmediate = (
|
||||
cb: (...args: unknown[]) => void,
|
||||
...args: unknown[]
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
cb: (...args: any[]) => void,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
...args: any[]
|
||||
): number => window.setTimeout(cb, 0, ...args);
|
||||
export const clearImmediate = window.clearTimeout;
|
||||
|
|
Loading…
Add table
Reference in a new issue