Skip to content

Commit

Permalink
[bugfix] Correct min/max TypeScript signatures (#4360)
Browse files Browse the repository at this point in the history
* Fix #4316: Update TypeScript signatures

* Add min & max typescript tests

* Add overload signatures
  • Loading branch information
ashsearle authored and marwahaha committed Mar 2, 2018
1 parent 8817814 commit 1860a7a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions moment.d.ts
Expand Up @@ -684,8 +684,10 @@ declare namespace moment {
export function weekdaysMin(localeSorted: boolean, format: string): string[];
export function weekdaysMin(localeSorted: boolean, format: string, index: number): string;

export function min(...moments: MomentInput[]): Moment;
export function max(...moments: MomentInput[]): Moment;
export function min(moments: Moment[]): Moment;
export function min(...moments: Moment[]): Moment;
export function max(moments: Moment[]): Moment;
export function max(...moments: Moment[]): Moment;

/**
* Returns unix time in milliseconds. Overwrite for profit.
Expand Down
5 changes: 5 additions & 0 deletions typing-tests/moment-tests.ts
Expand Up @@ -200,6 +200,11 @@ a8.diff(b8, 'days');
a8.diff(b8, 'years')
a8.diff(b8, 'years', true);

moment.min([a8, b8]);
moment.min(a8, b8);
moment.max([a8, b8]);
moment.max(a8, b8);

moment([2007, 0, 29]).toDate();
moment([2007, 1, 23]).toISOString();
moment(1318874398806).valueOf();
Expand Down

0 comments on commit 1860a7a

Please sign in to comment.