1- import type Moment from " moment" ;
1+ import type Moment from ' moment' ;
22
3- declare module "moment-range" {
4- declare type Shorthand = 'years' | 'year' | 'quarters' | 'quarter' | 'months' | 'month' | 'weeks' | 'week' | 'days' | 'day' | 'hours' | 'hour' | 'minutes' | 'minute' | 'seconds' | 'second' | 'milliseconds' | 'millisecond';
3+ declare module 'moment-range' {
4+ declare type Base = (
5+ 'year' | 'years' | 'y' |
6+ 'month' | 'months' | 'M' |
7+ 'week' | 'weeks' | 'w' |
8+ 'day' | 'days' | 'd' |
9+ 'hour' | 'hours' | 'h' |
10+ 'minute' | 'minutes' | 'm' |
11+ 'second' | 'seconds' | 's' |
12+ 'millisecond' | 'milliseconds' | 'ms'
13+ );
14+
15+ declare type _quarter = 'quarter' | 'quarters' | 'Q';
16+
17+ declare type UnitOfTimeDiff = Base | _quarter;
518
619 declare function extendMoment(moment: Class<Moment>): Class<Moment>;
720
821 declare class DateRange {
922 start: Moment;
1023 end: Moment;
1124
12- constructor(start: Date, end: Date): void;
13- constructor(start: Moment, end: Moment): void;
14- constructor(range: [Date, Date]): void;
15- constructor(range: [Moment, Moment]): void;
25+ constructor(start: Date | Moment, end: Date | Moment): void;
26+ constructor(range: [Date | Moment, Date | Moment]): void;
1627 constructor(range: string): void;
28+ constructor(): void;
1729
1830 adjacent(other: DateRange): bool;
1931
20- add(other: DateRange): ?DateRange;
32+ add(other: DateRange, options?: {| adjacent?: bool |} ): ?DateRange;
2133
22- by(interval: Shorthand , options?: {| excludeEnd?: bool, step?: number, |}): Iterable<Moment>;
34+ by(interval: UnitOfTimeDiff , options?: {| excludeEnd?: bool, step?: number, |}): Iterable<Moment>;
2335 // @deprecated 4.0.0
24- by(interval: Shorthand , options?: {| exclusive?: bool, step?: number, |}): Iterable<Moment>;
36+ by(interval: UnitOfTimeDiff , options?: {| exclusive?: bool, step?: number, |}): Iterable<Moment>;
2537
2638 byRange(interval: DateRange, options?: {| excludeEnd?: bool; step?: number, |}): Iterable<Moment>;
2739 // @deprecated 4.0.0
@@ -35,9 +47,9 @@ declare module "moment-range" {
3547 // @deprecated 4.0.0
3648 contains(other: Date | DateRange | Moment, options?: {| exclusive: bool, |}): bool;
3749
38- diff(unit: ?Shorthand, rounded : ?bool): number;
50+ diff(unit: ?UnitOfTimeDiff, precise : ?bool): number;
3951
40- duration(unit: ?Shorthand, rounded : ?bool): number;
52+ duration(unit: ?UnitOfTimeDiff, precise : ?bool): number;
4153
4254 intersect(other: DateRange): ?DateRange;
4355
@@ -47,19 +59,19 @@ declare module "moment-range" {
4759
4860 overlaps(other: DateRange, options?: {| adjacent: bool, |}): bool;
4961
50- reverseBy(interval: Shorthand , options?: {| excludeStart?: bool, step?: number, |}): Iterable<Moment>;
62+ reverseBy(interval: UnitOfTimeDiff , options?: {| excludeStart?: bool, step?: number, |}): Iterable<Moment>;
5163 // @deprecated 4.0.0
52- reverseBy(interval: Shorthand , options?: {| exclusive?: bool, step?: number, |}): Iterable<Moment>;
64+ reverseBy(interval: UnitOfTimeDiff , options?: {| exclusive?: bool, step?: number, |}): Iterable<Moment>;
5365
5466 reverseByRange(interval: DateRange, options?: {| excludeStart?: bool, step?: number, |}): Iterable<Moment>;
5567 // @deprecated 4.0.0
5668 reverseByRange(interval: DateRange, options?: {| exclusive?: bool, step?: number, |}): Iterable<Moment>;
5769
58- snapTo(interval: Shorthand ): DateRange;
70+ snapTo(interval: UnitOfTimeDiff ): DateRange;
5971
6072 subtract(other: DateRange): Array<DateRange>;
6173
62- toDate(): Array< Date> ;
74+ toDate(): [ Date, Date] ;
6375
6476 toString(): string;
6577
0 commit comments