Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: setTimeout and co. have too strict types #5412

Merged
merged 1 commit into from May 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions cli/js/lib.deno.shared_globals.d.ts
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion cli/js/web/timers.ts
Expand Up @@ -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) {
Expand Down
6 changes: 4 additions & 2 deletions std/node/timers.ts
Expand Up @@ -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;