question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix setTimeout/setInterval/setImmediate functions

See original GitHub issue

Fix too lax typings.

TypeScript Version: master

Expected behavior:

declare function setTimeout(handler: (...args: any[]) => void, timeout?: number, ...args: any[]): number;

Actual behavior:

declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number;
declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number;

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
aluanhaddadcommented, Nov 2, 2017

Be aware, that if you pass a string it is equivalent to eval.

Douglas Crockford warned of this.

Perhaps this second declaration could go into @RyanCavanaugh’s proposed Annex B 😉

0reactions
xaviergxfcommented, Sep 1, 2021

Hi, no news about this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scheduling: setTimeout and setInterval
setTimeout allows us to run a function once after the interval of time. ... The nested setTimeout guarantees the fixed delay (here 100ms)....
Read more >
NodeJS - setTimeout(fn,0) vs setImmediate(fn) - Stack Overflow
setImmediate () is to schedule the immediate execution of callback after I/O events callbacks and before setTimeout and setInterval .
Read more >
setImmediate() vs setTimeout() vs process.nextTick()
Use setTimeout() when you want to execute some function asynchronously, after a specified delay and after finishing the current block. When you ...
Read more >
Eventloop in NodeJS: setTimeout, setImmediate vs process ...
Here's the execution order of setTimeout, setImmediate, process. ... timers: this phase executes callbacks scheduled by setTimeout() and setInterval() ...
Read more >
setTimeout vs setImmediate vs process.nextTick - Logicmason
On the surface, it appears that all three functions do the same thing—they execute the ... Timers: callbacks from setInterval or setTimeout
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found