From: Ash Date: Fri, 2 Mar 2018 19:00:36 +0000 (+0000) Subject: [bugfix] Correct min/max TypeScript signatures (#4360) X-Git-Tag: 2.21.0~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1860a7ae06e18348692d84275059eee7cb8c19d2;p=thirdparty%2Fmoment.git [bugfix] Correct min/max TypeScript signatures (#4360) * Fix #4316: Update TypeScript signatures * Add min & max typescript tests * Add overload signatures --- diff --git a/moment.d.ts b/moment.d.ts index 0e7493360..a7ce04954 100644 --- a/moment.d.ts +++ b/moment.d.ts @@ -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. diff --git a/typing-tests/moment-tests.ts b/typing-tests/moment-tests.ts index bafdf1175..9373c2c74 100644 --- a/typing-tests/moment-tests.ts +++ b/typing-tests/moment-tests.ts @@ -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();