]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
[bugfix] Correct min/max TypeScript signatures (#4360)
authorAsh <ash@hexmen.com>
Fri, 2 Mar 2018 19:00:36 +0000 (19:00 +0000)
committerKunal Marwaha <marwahaha@berkeley.edu>
Fri, 2 Mar 2018 19:00:36 +0000 (11:00 -0800)
* Fix #4316: Update TypeScript signatures

* Add min & max typescript tests

* Add overload signatures

moment.d.ts
typing-tests/moment-tests.ts

index 0e749336074b6f66b122e0b2bd17a2c4837d7ce7..a7ce049544384e9cc8a4a08987d29e65a8ae2ffd 100644 (file)
@@ -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.
index bafdf117528f2bece7472aba79f376d06f2a7da4..9373c2c7464cb047a76be5becb91defbac6f577b 100644 (file)
@@ -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();