Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#8765 from seansfkelley/moment-merg…
Browse files Browse the repository at this point in the history
…e-unionable-types

Make moment's typings for parsing stricter and also allow them to accept union types.
  • Loading branch information
horiuchi committed Mar 30, 2016
2 parents 0bc5c30 + 1ec0366 commit dbb2d9f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 25 deletions.
20 changes: 4 additions & 16 deletions moment-timezone/moment-timezone.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 9 additions & 9 deletions moment/moment-node.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -571,21 +571,21 @@ declare namespace moment {
yy: any;
}

interface MomentBuiltinFormat {
__momentBuiltinFormatBrand: any;
}

type MomentFormatSpecification = string | MomentBuiltinFormat | (string | MomentBuiltinFormat)[];

interface MomentStatic {
version: string;
fn: 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;
Expand Down Expand Up @@ -675,7 +675,7 @@ declare namespace moment {
/**
* Constant used to enable explicit ISO_8601 format parsing.
*/
ISO_8601(): void;
ISO_8601: MomentBuiltinFormat;

defaultFormat: string;
}
Expand Down

0 comments on commit dbb2d9f

Please sign in to comment.