Merge pull request #8765 from seansfkelley/moment-merge-unionable-types

Make moment's typings for parsing stricter and also allow them to accept union types.
This commit is contained in:
Horiuchi_H
2016-03-30 13:01:32 +09:00
2 changed files with 13 additions and 25 deletions
+4 -16
View File
@@ -35,22 +35,10 @@ interface MomentTimezone {
(date: number, timezone: string): moment.Moment;
(date: number[], timezone: string): moment.Moment;
(date: string, timezone: string): moment.Moment;
(date: string, format: string, timezone: string): moment.Moment;
(date: string, format: string, strict: boolean, timezone: string): moment.Moment;
(date: string, format: string, language: string, timezone: string): moment.Moment;
(date: string, format: string, language: string, strict: boolean, timezone: string): moment.Moment;
(date: string, formats: string[], timezone: string): moment.Moment;
(date: string, formats: string[], strict: boolean, timezone: string): moment.Moment;
(date: string, formats: string[], language: string, timezone: string): moment.Moment;
(date: string, formats: string[], language: string, strict: boolean, timezone: string): moment.Moment;
(date: string, specialFormat: () => void, timezone: string): moment.Moment;
(date: string, specialFormat: () => void, strict: boolean, timezone: string): moment.Moment;
(date: string, specialFormat: () => void, language: string, timezone: string): moment.Moment;
(date: string, specialFormat: () => void, language: string, strict: boolean, timezone: string): moment.Moment;
(date: string, formatsIncludingSpecial: any[], timezone: string): moment.Moment;
(date: string, formatsIncludingSpecial: any[], strict: boolean, timezone: string): moment.Moment;
(date: string, formatsIncludingSpecial: any[], language: string, timezone: string): moment.Moment;
(date: string, formatsIncludingSpecial: any[], language: string, strict: boolean, timezone: string): moment.Moment;
(date: string, format: moment.MomentFormatSpecification, timezone: string): moment.Moment;
(date: string, format: moment.MomentFormatSpecification, strict: boolean, timezone: string): moment.Moment;
(date: string, format: moment.MomentFormatSpecification, language: string, timezone: string): moment.Moment;
(date: string, format: moment.MomentFormatSpecification, language: string, strict: boolean, timezone: string): moment.Moment;
(date: Date, timezone: string): moment.Moment;
(date: moment.Moment, timezone: string): moment.Moment;
(date: Object, timezone: string): moment.Moment;
+9 -9
View File
@@ -571,6 +571,12 @@ declare namespace moment {
yy: any;
}
interface MomentBuiltinFormat {
__momentBuiltinFormatBrand: any;
}
type MomentFormatSpecification = string | MomentBuiltinFormat | (string | MomentBuiltinFormat)[];
interface MomentStatic {
version: string;
fn: Moment;
@@ -578,14 +584,8 @@ declare namespace moment {
(): Moment;
(date: number): Moment;
(date: number[]): Moment;
(date: string, format?: string, strict?: boolean): Moment;
(date: string, format?: string, language?: string, strict?: boolean): Moment;
(date: string, formats: string[], strict?: boolean): Moment;
(date: string, formats: string[], language?: string, strict?: boolean): Moment;
(date: string, specialFormat: () => void, strict?: boolean): Moment;
(date: string, specialFormat: () => void, language?: string, strict?: boolean): Moment;
(date: string, formatsIncludingSpecial: any[], strict?: boolean): Moment;
(date: string, formatsIncludingSpecial: any[], language?: string, strict?: boolean): Moment;
(date: string, format?: MomentFormatSpecification, strict?: boolean): Moment;
(date: string, format?: MomentFormatSpecification, language?: string, strict?: boolean): Moment;
(date: Date): Moment;
(date: Moment): Moment;
(date: Object): Moment;
@@ -675,7 +675,7 @@ declare namespace moment {
/**
* Constant used to enable explicit ISO_8601 format parsing.
*/
ISO_8601(): void;
ISO_8601: MomentBuiltinFormat;
defaultFormat: string;
}