Fix setTimeout/setInterval/setImmediate functions
See original GitHub issueFix 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:
- Created 6 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Be aware, that if you pass a
string
it is equivalent toeval
.Douglas Crockford warned of this.
Perhaps this second declaration could go into @RyanCavanaugh’s proposed Annex B 😉
Hi, no news about this?