Skip to content

Commit

Permalink
Merge pull request #98 from lbolla/setTimeout
Browse files Browse the repository at this point in the history
Declare optional parameters according to HTML standard
  • Loading branch information
avikchaudhuri committed Nov 21, 2014
2 parents 9459339 + 1ba90ae commit 4693ff4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,10 @@ declare class DataView extends ArrayBufferView {
declare var btoa: (rawString: string) => string;
declare var atob: (encodedString: string) => string;

declare function clearInterval(intervalId: number): void;
declare function clearTimeout(timeoutId: any): void;
declare function setTimeout(callback: any, ms: number, ...args: Array<any>): number;
declare function setInterval(callback: any, ms: number, ...args: Array<any>): number;
declare function clearInterval(intervalId?: number): void;
declare function clearTimeout(timeoutId?: any): void;
declare function setTimeout(callback: any, ms?: number, ...args: Array<any>): number;
declare function setInterval(callback: any, ms?: number, ...args: Array<any>): number;

/* NodeJS */

Expand Down

1 comment on commit 4693ff4

@oyvindkinsey
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@avikchaudhuri, in this case it seems like the original spec is bad, and that by enforcing a subset of it (not having these be optional), we'd be increasing the quality of the code written.
With this change, writing clearTimeout() becomes valid, although this is a known no-op, which is very likely not what the author intended (clear all timeouts?).

Please sign in to comment.