From 9501a2355b5290f56a4109031df0745ee78c9234 Mon Sep 17 00:00:00 2001 From: Niklas Walter Date: Sun, 29 Jan 2017 01:03:23 +0100 Subject: [PATCH 1/4] Update moment-duration-format to work correctly Signed-off-by: Niklas Walter --- moment-duration-format/package.json | 5 +++++ moment-duration-format/tslint.json | 1 + types/moment-duration-format/index.d.ts | 9 +++++---- 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 moment-duration-format/package.json create mode 100644 moment-duration-format/tslint.json diff --git a/moment-duration-format/package.json b/moment-duration-format/package.json new file mode 100644 index 0000000000..4c6d24a445 --- /dev/null +++ b/moment-duration-format/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "moment": ">=2.14.0" + } +} \ No newline at end of file diff --git a/moment-duration-format/tslint.json b/moment-duration-format/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/moment-duration-format/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file diff --git a/types/moment-duration-format/index.d.ts b/types/moment-duration-format/index.d.ts index eb81f2551a..5c8ca1965e 100644 --- a/types/moment-duration-format/index.d.ts +++ b/types/moment-duration-format/index.d.ts @@ -1,11 +1,12 @@ -// Type definitions for moment-duration-format v1.3.0 +// Type definitions for moment-duration-format 1.3 // Project: https://github.com/jsmreese/moment-duration-format -// Definitions by: Swint De Coninck +// Definitions by: Swint De Coninck , Niklas Walter // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +import * as moment from "moment"; -declare namespace moment { +declare module "moment" { interface Duration { format(template: string, precision?: string, settings?: any): string; } -} \ No newline at end of file +} From b1cbf63f91665b266f11ec4d440f25c96805835b Mon Sep 17 00:00:00 2001 From: Niklas Walter Date: Fri, 7 Apr 2017 18:20:08 +0200 Subject: [PATCH 2/4] Add type declaration for settings object to duration format method. --- types/moment-duration-format/index.d.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/types/moment-duration-format/index.d.ts b/types/moment-duration-format/index.d.ts index 5c8ca1965e..a3ce7bb300 100644 --- a/types/moment-duration-format/index.d.ts +++ b/types/moment-duration-format/index.d.ts @@ -7,6 +7,13 @@ import * as moment from "moment"; declare module "moment" { interface Duration { - format(template: string, precision?: string, settings?: any): string; + format(template: string, precision?: string, settings?: DurationFormatSettings): string; + } + + interface DurationFormatSettings { + template: string; + precision: number; + trim: boolean; + forceLength: boolean; } } From 7972e1fb1c8ea323d49b5d026658ee3b1cdf07a0 Mon Sep 17 00:00:00 2001 From: Niklas Walter Date: Fri, 7 Apr 2017 18:25:48 +0200 Subject: [PATCH 3/4] move packages to new folder --- .../moment-duration-format}/package.json | 0 .../moment-duration-format}/tslint.json | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {moment-duration-format => types/moment-duration-format}/package.json (100%) rename {moment-duration-format => types/moment-duration-format}/tslint.json (100%) diff --git a/moment-duration-format/package.json b/types/moment-duration-format/package.json similarity index 100% rename from moment-duration-format/package.json rename to types/moment-duration-format/package.json diff --git a/moment-duration-format/tslint.json b/types/moment-duration-format/tslint.json similarity index 100% rename from moment-duration-format/tslint.json rename to types/moment-duration-format/tslint.json From fb72330b03e8d4569fdae5a36190d7596327292c Mon Sep 17 00:00:00 2001 From: Niklas Walter Date: Mon, 10 Apr 2017 09:54:08 +0200 Subject: [PATCH 4/4] Correct type for precision parameter --- types/moment-duration-format/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/moment-duration-format/index.d.ts b/types/moment-duration-format/index.d.ts index a3ce7bb300..34179e6dc4 100644 --- a/types/moment-duration-format/index.d.ts +++ b/types/moment-duration-format/index.d.ts @@ -7,7 +7,7 @@ import * as moment from "moment"; declare module "moment" { interface Duration { - format(template: string, precision?: string, settings?: DurationFormatSettings): string; + format(template: string, precision?: number, settings?: DurationFormatSettings): string; } interface DurationFormatSettings {