From 1860a7ae06e18348692d84275059eee7cb8c19d2 Mon Sep 17 00:00:00 2001 From: Ash Date: Fri, 2 Mar 2018 19:00:36 +0000 Subject: [PATCH] [bugfix] Correct min/max TypeScript signatures (#4360) * Fix #4316: Update TypeScript signatures * Add min & max typescript tests * Add overload signatures --- moment.d.ts | 6 ++++-- typing-tests/moment-tests.ts | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) 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(); -- 2.47.2