@types/luxon
Advanced tools
Comparing version 3.3.5 to 3.3.6
{ | ||
"name": "@types/luxon", | ||
"version": "3.3.5", | ||
"version": "3.3.6", | ||
"description": "TypeScript definitions for luxon", | ||
@@ -9,55 +9,10 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/luxon", | ||
{ | ||
"name": "Hyeonseok Yang", | ||
"githubUsername": "FourwingsY", | ||
"url": "https://github.com/FourwingsY" | ||
"name": "Carson Full", | ||
"githubUsername": "carsonf", | ||
"url": "https://github.com/carsonf" | ||
}, | ||
{ | ||
"name": "Jonathan Siebern", | ||
"githubUsername": "jsiebern", | ||
"url": "https://github.com/jsiebern" | ||
}, | ||
{ | ||
"name": "Matt R. Wilson", | ||
"githubUsername": "mastermatt", | ||
"url": "https://github.com/mastermatt" | ||
}, | ||
{ | ||
"name": "Pietro Vismara", | ||
"githubUsername": "pietrovismara", | ||
"url": "https://github.com/pietrovismara" | ||
}, | ||
{ | ||
"name": "Janeene Beeforth", | ||
"githubUsername": "dawnmist", | ||
"url": "https://github.com/dawnmist" | ||
}, | ||
{ | ||
"name": "Jason Yu", | ||
"githubUsername": "ycmjason", | ||
"url": "https://github.com/ycmjason" | ||
}, | ||
{ | ||
"name": "Aitor Pérez Rodal", | ||
"githubUsername": "Aitor1995", | ||
"url": "https://github.com/Aitor1995" | ||
}, | ||
{ | ||
"name": "Piotr Błażejewicz", | ||
"githubUsername": "peterblazejewicz", | ||
"url": "https://github.com/peterblazejewicz" | ||
}, | ||
{ | ||
"name": "Carson Full", | ||
"githubUsername": "carsonf", | ||
"url": "https://github.com/carsonf" | ||
}, | ||
{ | ||
"name": "Hugo Silva", | ||
"githubUsername": "hugofpsilva", | ||
"url": "https://github.com/hugofpsilva" | ||
}, | ||
{ | ||
"name": "Martin Badin", | ||
"githubUsername": "martin-badin", | ||
"url": "https://github.com/martin-badin" | ||
} | ||
@@ -74,4 +29,4 @@ ], | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "8e8aab585a273a2e32b78f03d59992427eb3059933f453e16578aa1bd1fc54bb", | ||
"typeScriptVersion": "4.5" | ||
"typesPublisherContentHash": "50345fcf8cb57d09d761a8a28715b4e6eacfbd26ab8b81613b1b8c6359af7d79", | ||
"typeScriptVersion": "4.6" | ||
} |
@@ -11,6 +11,6 @@ # Installation | ||
### Additional Details | ||
* Last updated: Mon, 20 Nov 2023 23:36:24 GMT | ||
* Last updated: Thu, 30 Nov 2023 20:35:52 GMT | ||
* Dependencies: none | ||
# Credits | ||
These definitions were written by [Hyeonseok Yang](https://github.com/FourwingsY), [Jonathan Siebern](https://github.com/jsiebern), [Matt R. Wilson](https://github.com/mastermatt), [Pietro Vismara](https://github.com/pietrovismara), [Janeene Beeforth](https://github.com/dawnmist), [Jason Yu](https://github.com/ycmjason), [Aitor Pérez Rodal](https://github.com/Aitor1995), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Carson Full](https://github.com/carsonf), [Hugo Silva](https://github.com/hugofpsilva), and [Martin Badin](https://github.com/martin-badin). | ||
These definitions were written by [Carson Full](https://github.com/carsonf), and [Piotr Błażejewicz](https://github.com/peterblazejewicz). |
import { TSSettings } from "./settings"; | ||
export type CanBeInvalid = TSSettings extends { throwOnInvalid: true } ? false : true; | ||
export type IfInvalid<T> = CanBeInvalid extends true ? T : never; | ||
export type DefaultValidity = CanBeInvalid extends true ? boolean : true; | ||
export type IfValid<ValidType, InvalidType, ThisIsValid extends boolean | undefined> = ThisIsValid extends true | ||
? ValidType | ||
: ThisIsValid extends false ? InvalidType | ||
: CanBeInvalid extends true ? ValidType | InvalidType | ||
: ValidType; | ||
export type Valid = true; | ||
export type Invalid = false; |
@@ -10,3 +10,3 @@ import { | ||
} from "../index"; | ||
import { CanBeInvalid, IfInvalid } from "./_util"; | ||
import { CanBeInvalid, DefaultValidity, IfValid, Invalid, Valid } from "./_util"; | ||
import { Duration, DurationLike, DurationUnits } from "./duration"; | ||
@@ -206,9 +206,14 @@ import { Interval } from "./interval"; | ||
export type ToObjectOutput<IncludeConfig extends boolean | undefined = undefined> = CanBeInvalid extends true | ||
? Partial<_ToObjectOutput<IncludeConfig>> | ||
: _ToObjectOutput<IncludeConfig>; | ||
export type ToObjectOutput< | ||
IncludeConfig extends boolean | undefined = undefined, | ||
IsValid extends boolean | undefined = undefined, | ||
> = IsValid extends true ? _ToObjectOutput<IncludeConfig> | ||
: CanBeInvalid extends false ? _ToObjectOutput<IncludeConfig> | ||
: Partial<_ToObjectOutput<IncludeConfig>>; | ||
/** @internal */ | ||
export type _ToObjectOutput<IncludeConfig extends boolean | undefined = undefined> = | ||
& Record<Exclude<DateTimeUnit, "quarter" | "week">, number> | ||
& Record<_ToObjectUnit, number> | ||
& (IncludeConfig extends true ? LocaleOptions : unknown); | ||
/** @internal */ | ||
export type _ToObjectUnit = Exclude<DateTimeUnit, "quarter" | "week">; | ||
@@ -377,2 +382,4 @@ export interface ToRelativeOptions extends Omit<ToRelativeCalendarOptions, "unit"> { | ||
export type DateTimeMaybeValid = CanBeInvalid extends true ? (DateTime<Valid> | DateTime<Invalid>) : DateTime; | ||
/** | ||
@@ -405,3 +412,3 @@ * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. | ||
*/ | ||
export class DateTime { | ||
export class DateTime<IsValid extends boolean = DefaultValidity> { | ||
/** | ||
@@ -414,3 +421,3 @@ * Create a DateTime for the current instant, in the system's time zone. | ||
*/ | ||
static now(): DateTime; | ||
static now(): DateTime<Valid>; | ||
@@ -459,3 +466,3 @@ /** | ||
opts?: DateTimeJSOptions, | ||
): DateTime; | ||
): DateTimeMaybeValid; | ||
static local( | ||
@@ -469,3 +476,3 @@ year: number, | ||
opts?: DateTimeJSOptions, | ||
): DateTime; | ||
): DateTimeMaybeValid; | ||
static local( | ||
@@ -478,8 +485,8 @@ year: number, | ||
opts?: DateTimeJSOptions, | ||
): DateTime; | ||
static local(year: number, month: number, day: number, hour: number, opts?: DateTimeJSOptions): DateTime; | ||
static local(year: number, month: number, day: number, opts?: DateTimeJSOptions): DateTime; | ||
static local(year: number, month: number, opts?: DateTimeJSOptions): DateTime; | ||
static local(year: number, opts?: DateTimeJSOptions): DateTime; | ||
static local(opts?: DateTimeJSOptions): DateTime; | ||
): DateTimeMaybeValid; | ||
static local(year: number, month: number, day: number, hour: number, opts?: DateTimeJSOptions): DateTimeMaybeValid; | ||
static local(year: number, month: number, day: number, opts?: DateTimeJSOptions): DateTimeMaybeValid; | ||
static local(year: number, month: number, opts?: DateTimeJSOptions): DateTimeMaybeValid; | ||
static local(year: number, opts?: DateTimeJSOptions): DateTimeMaybeValid; | ||
static local(opts?: DateTimeJSOptions): DateTime<Valid>; | ||
@@ -529,3 +536,3 @@ /** | ||
options?: LocaleOptions, | ||
): DateTime; | ||
): DateTimeMaybeValid; | ||
static utc( | ||
@@ -539,3 +546,3 @@ year: number, | ||
options?: LocaleOptions, | ||
): DateTime; | ||
): DateTimeMaybeValid; | ||
static utc( | ||
@@ -548,8 +555,8 @@ year: number, | ||
options?: LocaleOptions, | ||
): DateTime; | ||
static utc(year: number, month: number, day: number, hour: number, options?: LocaleOptions): DateTime; | ||
static utc(year: number, month: number, day: number, options?: LocaleOptions): DateTime; | ||
static utc(year: number, month: number, options?: LocaleOptions): DateTime; | ||
static utc(year: number, options?: LocaleOptions): DateTime; | ||
static utc(options?: LocaleOptions): DateTime; | ||
): DateTimeMaybeValid; | ||
static utc(year: number, month: number, day: number, hour: number, options?: LocaleOptions): DateTimeMaybeValid; | ||
static utc(year: number, month: number, day: number, options?: LocaleOptions): DateTimeMaybeValid; | ||
static utc(year: number, month: number, options?: LocaleOptions): DateTimeMaybeValid; | ||
static utc(year: number, options?: LocaleOptions): DateTimeMaybeValid; | ||
static utc(options?: LocaleOptions): DateTime<Valid>; | ||
@@ -563,3 +570,3 @@ /** | ||
*/ | ||
static fromJSDate(date: Date, options?: { zone?: string | Zone }): DateTime; | ||
static fromJSDate(date: Date, options?: { zone?: string | Zone }): DateTimeMaybeValid; | ||
@@ -576,3 +583,3 @@ /** | ||
*/ | ||
static fromMillis(milliseconds: number, options?: DateTimeJSOptions): DateTime; | ||
static fromMillis(milliseconds: number, options?: DateTimeJSOptions): DateTimeMaybeValid; | ||
@@ -589,3 +596,3 @@ /** | ||
*/ | ||
static fromSeconds(seconds: number, options?: DateTimeJSOptions): DateTime; | ||
static fromSeconds(seconds: number, options?: DateTimeJSOptions): DateTime<Valid>; | ||
@@ -628,3 +635,3 @@ /** | ||
*/ | ||
static fromObject(obj: DateObjectUnits, opts?: DateTimeJSOptions): DateTime; | ||
static fromObject(obj: DateObjectUnits, opts?: DateTimeJSOptions): DateTimeMaybeValid; | ||
@@ -653,3 +660,3 @@ /** | ||
*/ | ||
static fromISO(text: string, opts?: DateTimeOptions): DateTime; | ||
static fromISO(text: string, opts?: DateTimeOptions): DateTimeMaybeValid; | ||
@@ -675,3 +682,3 @@ /** | ||
*/ | ||
static fromRFC2822(text: string, opts?: DateTimeOptions): DateTime; | ||
static fromRFC2822(text: string, opts?: DateTimeOptions): DateTimeMaybeValid; | ||
@@ -700,3 +707,3 @@ /** | ||
*/ | ||
static fromHTTP(text: string, opts?: DateTimeOptions): DateTime; | ||
static fromHTTP(text: string, opts?: DateTimeOptions): DateTimeMaybeValid; | ||
@@ -717,3 +724,3 @@ /** | ||
*/ | ||
static fromFormat(text: string, fmt: string, opts?: DateTimeOptions): DateTime; | ||
static fromFormat(text: string, fmt: string, opts?: DateTimeOptions): DateTimeMaybeValid; | ||
@@ -723,3 +730,3 @@ /** | ||
*/ | ||
static fromString(text: string, format: string, options?: DateTimeOptions): DateTime; | ||
static fromString(text: string, format: string, options?: DateTimeOptions): DateTimeMaybeValid; | ||
@@ -755,3 +762,3 @@ /** | ||
*/ | ||
static fromSQL(text: string, opts?: DateTimeOptions): DateTime; | ||
static fromSQL(text: string, opts?: DateTimeOptions): DateTimeMaybeValid; | ||
@@ -764,3 +771,3 @@ /** | ||
*/ | ||
static invalid(reason: string, explanation?: string): DateTime; | ||
static invalid(reason: string, explanation?: string): DateTime<Invalid>; | ||
@@ -772,3 +779,3 @@ /** | ||
*/ | ||
static isDateTime(o: unknown): o is DateTime; | ||
static isDateTime(o: unknown): o is DateTimeMaybeValid; | ||
@@ -815,3 +822,3 @@ /** | ||
*/ | ||
get isValid(): boolean; | ||
get isValid(): IfValid<true, false, IsValid>; | ||
@@ -821,3 +828,3 @@ /** | ||
*/ | ||
get invalidReason(): string | null; | ||
get invalidReason(): IfValid<string, null, IsValid>; | ||
@@ -827,3 +834,3 @@ /** | ||
*/ | ||
get invalidExplanation(): string | null; | ||
get invalidExplanation(): IfValid<string | null, null, IsValid>; | ||
@@ -833,3 +840,3 @@ /** | ||
*/ | ||
get locale(): string | IfInvalid<null>; | ||
get locale(): IfValid<string, null, IsValid>; | ||
@@ -839,3 +846,3 @@ /** | ||
*/ | ||
get numberingSystem(): string | IfInvalid<null>; | ||
get numberingSystem(): IfValid<string, null, IsValid>; | ||
@@ -845,3 +852,3 @@ /** | ||
*/ | ||
get outputCalendar(): string | IfInvalid<null>; | ||
get outputCalendar(): IfValid<string, null, IsValid>; | ||
@@ -851,3 +858,3 @@ /** | ||
*/ | ||
get zone(): Zone; | ||
get zone(): Zone<IsValid>; | ||
@@ -857,3 +864,3 @@ /** | ||
*/ | ||
get zoneName(): string | IfInvalid<null>; | ||
get zoneName(): IfValid<string, null, IsValid>; | ||
@@ -865,3 +872,3 @@ /** | ||
*/ | ||
get year(): number | IfInvalid<typeof NaN>; | ||
get year(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -873,3 +880,3 @@ /** | ||
*/ | ||
get quarter(): QuarterNumbers | IfInvalid<typeof NaN>; | ||
get quarter(): IfValid<QuarterNumbers, typeof NaN, IsValid>; | ||
@@ -881,3 +888,3 @@ /** | ||
*/ | ||
get month(): MonthNumbers | IfInvalid<typeof NaN>; | ||
get month(): IfValid<MonthNumbers, typeof NaN, IsValid>; | ||
@@ -889,3 +896,3 @@ /** | ||
*/ | ||
get day(): DayNumbers | IfInvalid<typeof NaN>; | ||
get day(): IfValid<DayNumbers, typeof NaN, IsValid>; | ||
@@ -897,3 +904,3 @@ /** | ||
*/ | ||
get hour(): HourNumbers | IfInvalid<typeof NaN>; | ||
get hour(): IfValid<HourNumbers, typeof NaN, IsValid>; | ||
@@ -906,3 +913,3 @@ /** | ||
*/ | ||
get minute(): MinuteNumbers | IfInvalid<typeof NaN>; | ||
get minute(): IfValid<MinuteNumbers, typeof NaN, IsValid>; | ||
@@ -915,3 +922,3 @@ /** | ||
*/ | ||
get second(): SecondNumbers | IfInvalid<typeof NaN>; | ||
get second(): IfValid<SecondNumbers, typeof NaN, IsValid>; | ||
@@ -924,3 +931,3 @@ /** | ||
*/ | ||
get millisecond(): number | IfInvalid<typeof NaN>; | ||
get millisecond(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -934,3 +941,3 @@ /** | ||
*/ | ||
get weekYear(): number | IfInvalid<typeof NaN>; | ||
get weekYear(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -944,3 +951,3 @@ /** | ||
*/ | ||
get weekNumber(): WeekNumbers | IfInvalid<typeof NaN>; | ||
get weekNumber(): IfValid<WeekNumbers, typeof NaN, IsValid>; | ||
@@ -955,3 +962,3 @@ /** | ||
*/ | ||
get weekday(): WeekdayNumbers | IfInvalid<typeof NaN>; | ||
get weekday(): IfValid<WeekdayNumbers, typeof NaN, IsValid>; | ||
@@ -964,3 +971,3 @@ /** | ||
*/ | ||
get ordinal(): number | IfInvalid<typeof NaN>; | ||
get ordinal(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -974,3 +981,3 @@ /** | ||
*/ | ||
get monthShort(): string | IfInvalid<null>; | ||
get monthShort(): IfValid<string, null, IsValid>; | ||
@@ -984,3 +991,3 @@ /** | ||
*/ | ||
get monthLong(): string | IfInvalid<null>; | ||
get monthLong(): IfValid<string, null, IsValid>; | ||
@@ -994,3 +1001,3 @@ /** | ||
*/ | ||
get weekdayShort(): string | IfInvalid<null>; | ||
get weekdayShort(): IfValid<string, null, IsValid>; | ||
@@ -1004,3 +1011,3 @@ /** | ||
*/ | ||
get weekdayLong(): string | IfInvalid<null>; | ||
get weekdayLong(): IfValid<string, null, IsValid>; | ||
@@ -1015,3 +1022,3 @@ /** | ||
*/ | ||
get offset(): number | IfInvalid<typeof NaN>; | ||
get offset(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -1022,3 +1029,3 @@ /** | ||
*/ | ||
get offsetNameShort(): string | IfInvalid<null>; | ||
get offsetNameShort(): IfValid<string, null, IsValid>; | ||
@@ -1029,3 +1036,3 @@ /** | ||
*/ | ||
get offsetNameLong(): string | IfInvalid<null>; | ||
get offsetNameLong(): IfValid<string, null, IsValid>; | ||
@@ -1035,3 +1042,3 @@ /** | ||
*/ | ||
get isOffsetFixed(): boolean | IfInvalid<null>; | ||
get isOffsetFixed(): IfValid<boolean, null, IsValid>; | ||
@@ -1041,3 +1048,3 @@ /** | ||
*/ | ||
get isInDST(): boolean | IfInvalid<false>; | ||
get isInDST(): IfValid<boolean, false, IsValid>; | ||
@@ -1062,3 +1069,3 @@ /** | ||
*/ | ||
get daysInMonth(): PossibleDaysInMonth | IfInvalid<undefined>; | ||
get daysInMonth(): IfValid<PossibleDaysInMonth, undefined, IsValid>; | ||
@@ -1073,3 +1080,3 @@ /** | ||
*/ | ||
get daysInYear(): PossibleDaysInYear | IfInvalid<typeof NaN>; | ||
get daysInYear(): IfValid<PossibleDaysInYear, typeof NaN, IsValid>; | ||
@@ -1085,3 +1092,3 @@ /** | ||
*/ | ||
get weeksInWeekYear(): PossibleWeeksInYear | IfInvalid<typeof NaN>; | ||
get weeksInWeekYear(): IfValid<PossibleWeeksInYear, typeof NaN, IsValid>; | ||
@@ -1106,3 +1113,3 @@ /** | ||
*/ | ||
toUTC(offset?: number, opts?: ZoneOptions): DateTime; | ||
toUTC(offset?: number, opts?: ZoneOptions): this; | ||
@@ -1114,3 +1121,3 @@ /** | ||
*/ | ||
toLocal(): DateTime; | ||
toLocal(): this; | ||
@@ -1128,3 +1135,3 @@ /** | ||
*/ | ||
setZone(zone?: string | Zone, opts?: ZoneOptions): DateTime; | ||
setZone(zone?: string | Zone, opts?: ZoneOptions): DateTimeMaybeValid; | ||
@@ -1139,3 +1146,3 @@ /** | ||
*/ | ||
reconfigure(properties: LocaleOptions): DateTime; | ||
reconfigure(properties: LocaleOptions): this; | ||
@@ -1149,3 +1156,3 @@ /** | ||
*/ | ||
setLocale(locale: string): DateTime; | ||
setLocale(locale: string): this; | ||
@@ -1167,3 +1174,3 @@ /** | ||
*/ | ||
set(values: DateObjectUnits): DateTime; | ||
set(values: DateObjectUnits): this; | ||
@@ -1189,3 +1196,3 @@ /** | ||
*/ | ||
plus(duration: DurationLike): DateTime; | ||
plus(duration: DurationLike): this; | ||
@@ -1197,3 +1204,3 @@ /** | ||
*/ | ||
minus(duration: DurationLike): DateTime; | ||
minus(duration: DurationLike): this; | ||
@@ -1216,3 +1223,3 @@ /** | ||
*/ | ||
startOf(unit: DateTimeUnit): DateTime; | ||
startOf(unit: DateTimeUnit): this; | ||
@@ -1235,3 +1242,3 @@ /** | ||
*/ | ||
endOf(unit: DateTimeUnit): DateTime; | ||
endOf(unit: DateTimeUnit): this; | ||
@@ -1258,3 +1265,3 @@ // OUTPUT | ||
*/ | ||
toFormat(fmt: string, opts?: LocaleOptions): string | IfInvalid<"Invalid DateTime">; | ||
toFormat(fmt: string, opts?: LocaleOptions): IfValid<string, "Invalid DateTime", IsValid>; | ||
@@ -1289,3 +1296,6 @@ /** | ||
*/ | ||
toLocaleString(formatOpts?: DateTimeFormatOptions, opts?: LocaleOptions): string | IfInvalid<"Invalid DateTime">; | ||
toLocaleString( | ||
formatOpts?: DateTimeFormatOptions, | ||
opts?: LocaleOptions, | ||
): IfValid<string, "Invalid DateTime", IsValid>; | ||
@@ -1305,4 +1315,6 @@ /** | ||
* //=> ] | ||
* @example | ||
* DateTime.invalid('').toLocaleParts(); //=> [] | ||
*/ | ||
toLocaleParts(opts?: DateTimeFormatOptions): Intl.DateTimeFormatPart[] | IfInvalid<[]>; | ||
toLocaleParts(opts?: DateTimeFormatOptions): Intl.DateTimeFormatPart[]; | ||
@@ -1321,3 +1333,3 @@ /** | ||
*/ | ||
toISO(opts?: ToISOTimeOptions): string | IfInvalid<null>; | ||
toISO(opts?: ToISOTimeOptions): IfValid<string, null, IsValid>; | ||
@@ -1335,3 +1347,3 @@ /** | ||
*/ | ||
toISODate(opts?: ToISODateOptions): string | IfInvalid<null>; | ||
toISODate(opts?: ToISODateOptions): IfValid<string, null, IsValid>; | ||
@@ -1344,3 +1356,3 @@ /** | ||
*/ | ||
toISOWeekDate(): string | IfInvalid<null>; | ||
toISOWeekDate(): IfValid<string, null, IsValid>; | ||
@@ -1366,3 +1378,3 @@ /** | ||
*/ | ||
toISOTime(opts?: ToISOTimeOptions): string | IfInvalid<null>; | ||
toISOTime(opts?: ToISOTimeOptions): IfValid<string, null, IsValid>; | ||
@@ -1377,3 +1389,3 @@ /** | ||
*/ | ||
toRFC2822(): string | IfInvalid<null>; | ||
toRFC2822(): IfValid<string, null, IsValid>; | ||
@@ -1390,3 +1402,3 @@ /** | ||
*/ | ||
toHTTP(): string | IfInvalid<null>; | ||
toHTTP(): IfValid<string, null, IsValid>; | ||
@@ -1399,3 +1411,3 @@ /** | ||
*/ | ||
toSQLDate(): string | IfInvalid<null>; | ||
toSQLDate(): IfValid<string, null, IsValid>; | ||
@@ -1414,3 +1426,3 @@ /** | ||
*/ | ||
toSQLTime(opts?: ToSQLOptions): string | IfInvalid<null>; | ||
toSQLTime(opts?: ToSQLOptions): IfValid<string, null, IsValid>; | ||
@@ -1429,3 +1441,3 @@ /** | ||
*/ | ||
toSQL(opts?: ToSQLOptions): string | IfInvalid<null>; | ||
toSQL(opts?: ToSQLOptions): IfValid<string, null, IsValid>; | ||
@@ -1435,3 +1447,3 @@ /** | ||
*/ | ||
toString(): string | IfInvalid<"Invalid DateTime">; | ||
toString(): IfValid<string, "Invalid DateTime", IsValid>; | ||
@@ -1441,3 +1453,3 @@ /** | ||
*/ | ||
valueOf(): number | IfInvalid<typeof NaN>; | ||
valueOf(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -1447,3 +1459,3 @@ /** | ||
*/ | ||
toMillis(): number | IfInvalid<typeof NaN>; | ||
toMillis(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -1453,3 +1465,3 @@ /** | ||
*/ | ||
toSeconds(): number | IfInvalid<typeof NaN>; | ||
toSeconds(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -1459,3 +1471,3 @@ /** | ||
*/ | ||
toUnixInteger(): number | IfInvalid<typeof NaN>; | ||
toUnixInteger(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -1465,3 +1477,3 @@ /** | ||
*/ | ||
toJSON(): string | IfInvalid<null>; | ||
toJSON(): IfValid<string, null, IsValid>; | ||
@@ -1488,3 +1500,3 @@ /** | ||
includeConfig?: IncludeConfig; | ||
}): ToObjectOutput<IncludeConfig>; | ||
}): ToObjectOutput<IncludeConfig, IsValid>; | ||
@@ -1516,3 +1528,3 @@ /** | ||
*/ | ||
diff(otherDateTime: DateTime, unit?: DurationUnits, opts?: DiffOptions): Duration; | ||
diff(otherDateTime: DateTime, unit?: DurationUnits, opts?: DiffOptions): Duration<IsValid>; | ||
@@ -1527,3 +1539,3 @@ /** | ||
*/ | ||
diffNow(unit?: DurationUnits, opts?: DiffOptions): Duration; | ||
diffNow(unit?: DurationUnits, opts?: DiffOptions): Duration<Valid>; | ||
@@ -1535,3 +1547,3 @@ /** | ||
*/ | ||
until(otherDateTime: DateTime): Interval; | ||
until(otherDateTime: DateTime): IfValid<Interval<Valid>, DateTime<Invalid>, IsValid>; | ||
@@ -1548,3 +1560,3 @@ /** | ||
*/ | ||
hasSame(otherDateTime: DateTime, unit: DateTimeUnit): boolean | IfInvalid<false>; | ||
hasSame(otherDateTime: DateTime, unit: DateTimeUnit): IfValid<boolean, false, IsValid>; | ||
@@ -1558,3 +1570,3 @@ /** | ||
*/ | ||
equals(other: DateTime): boolean | IfInvalid<false>; | ||
equals(other: DateTime): IfValid<boolean, false, IsValid>; | ||
@@ -1579,3 +1591,3 @@ /** | ||
*/ | ||
toRelative(options?: ToRelativeOptions): string | IfInvalid<null>; | ||
toRelative(options?: ToRelativeOptions): IfValid<string, null, IsValid>; | ||
@@ -1595,3 +1607,3 @@ /** | ||
*/ | ||
toRelativeCalendar(options?: ToRelativeCalendarOptions): string | IfInvalid<null>; | ||
toRelativeCalendar(options?: ToRelativeCalendarOptions): IfValid<string, null, IsValid>; | ||
@@ -1603,3 +1615,5 @@ /** | ||
*/ | ||
static min(...dateTimes: DateTime[]): DateTime; | ||
static min<AllValid extends boolean>( | ||
...dateTimes: Array<DateTime<AllValid>> | ||
): (AllValid extends true ? DateTime<Valid> : never) | (AllValid extends false ? DateTime<Invalid> : never); | ||
@@ -1611,3 +1625,5 @@ /** | ||
*/ | ||
static max(...dateTimes: DateTime[]): DateTime; | ||
static max<AllValid extends boolean>( | ||
...dateTimes: Array<DateTime<AllValid>> | ||
): (AllValid extends true ? DateTime<Valid> : never) | (AllValid extends false ? DateTime<Invalid> : never); | ||
@@ -1614,0 +1630,0 @@ // MISC |
@@ -1,2 +0,2 @@ | ||
import { IfInvalid } from "./_util"; | ||
import { CanBeInvalid, DefaultValidity, IfValid, Invalid, Valid } from "./_util"; | ||
import { ConversionAccuracy } from "./datetime"; | ||
@@ -79,2 +79,4 @@ import { NumberingSystem } from "./misc"; | ||
export type DurationMaybeValid = CanBeInvalid extends true ? (Duration<Valid> | Duration<Invalid>) : Duration; | ||
/** | ||
@@ -97,3 +99,3 @@ * A Duration object represents a period of time, like "2 months" or "1 day, 1 hour". | ||
*/ | ||
export class Duration { | ||
export class Duration<IsValid extends boolean = DefaultValidity> { | ||
/** | ||
@@ -108,3 +110,3 @@ * Create Duration from a number of milliseconds. | ||
*/ | ||
static fromMillis(count: number, opts?: DurationOptions): Duration; | ||
static fromMillis(count: number, opts?: DurationOptions): Duration<Valid>; | ||
@@ -130,3 +132,3 @@ /** | ||
*/ | ||
static fromObject(obj: DurationLikeObject, opts?: DurationOptions): Duration; | ||
static fromObject(obj: DurationLikeObject, opts?: DurationOptions): Duration<Valid>; | ||
@@ -139,3 +141,3 @@ /** | ||
*/ | ||
static fromDurationLike(durationLike: DurationLike): Duration; | ||
static fromDurationLike(durationLike: DurationLike): Duration<Valid>; | ||
@@ -159,3 +161,3 @@ /** | ||
*/ | ||
static fromISO(text: string, opts?: DurationOptions): Duration; | ||
static fromISO(text: string, opts?: DurationOptions): DurationMaybeValid; | ||
@@ -183,3 +185,3 @@ /** | ||
*/ | ||
static fromISOTime(text: string, opts?: DurationOptions): Duration; | ||
static fromISOTime(text: string, opts?: DurationOptions): DurationMaybeValid; | ||
@@ -192,3 +194,3 @@ /** | ||
*/ | ||
static invalid(reason: string, explanation?: string): Duration; | ||
static invalid(reason: string, explanation?: string): Duration<Invalid>; | ||
@@ -200,3 +202,3 @@ /** | ||
*/ | ||
static isDuration(o: unknown): o is Duration; | ||
static isDuration(o: unknown): o is DurationMaybeValid; | ||
@@ -208,3 +210,3 @@ private constructor(config: unknown); | ||
*/ | ||
get locale(): string | IfInvalid<null>; | ||
get locale(): IfValid<string, null, IsValid>; | ||
@@ -214,3 +216,3 @@ /** | ||
*/ | ||
get numberingSystem(): string | IfInvalid<null>; | ||
get numberingSystem(): IfValid<string, null, IsValid>; | ||
@@ -241,3 +243,3 @@ /** | ||
*/ | ||
toFormat(fmt: string, opts?: { floor?: boolean | undefined }): string | IfInvalid<"Invalid Duration">; | ||
toFormat(fmt: string, opts?: { floor?: boolean | undefined }): IfValid<string, "Invalid Duration", IsValid>; | ||
@@ -281,3 +283,3 @@ /** | ||
*/ | ||
toISO(): string | IfInvalid<null>; | ||
toISO(): IfValid<string, null, IsValid>; | ||
@@ -305,3 +307,3 @@ /** | ||
*/ | ||
toISOTime(opts?: ToISOTimeDurationOptions): string | IfInvalid<null>; | ||
toISOTime(opts?: ToISOTimeDurationOptions): IfValid<string, null, IsValid>; | ||
@@ -311,3 +313,3 @@ /** | ||
*/ | ||
toJSON(): string | IfInvalid<null>; | ||
toJSON(): IfValid<string, null, IsValid>; | ||
@@ -317,3 +319,3 @@ /** | ||
*/ | ||
toString(): string | IfInvalid<null>; | ||
toString(): IfValid<string, null, IsValid>; | ||
@@ -323,3 +325,3 @@ /** | ||
*/ | ||
toMillis(): number | IfInvalid<typeof NaN>; | ||
toMillis(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -329,3 +331,3 @@ /** | ||
*/ | ||
valueOf(): number | IfInvalid<typeof NaN>; | ||
valueOf(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -337,3 +339,3 @@ /** | ||
*/ | ||
plus(duration: DurationLike): Duration; | ||
plus(duration: DurationLike): this; | ||
@@ -345,3 +347,3 @@ /** | ||
*/ | ||
minus(duration: DurationLike): Duration; | ||
minus(duration: DurationLike): this; | ||
@@ -356,3 +358,3 @@ /** | ||
*/ | ||
mapUnits(fn: (x: number, u?: DurationUnit) => number): Duration; | ||
mapUnits(fn: (x: number, u?: DurationUnit) => number): this; | ||
@@ -371,3 +373,3 @@ /** | ||
*/ | ||
get(unit: DurationUnit): number | IfInvalid<typeof NaN>; | ||
get(unit: DurationUnit): IfValid<number, typeof NaN, IsValid>; | ||
@@ -384,3 +386,3 @@ /** | ||
*/ | ||
set(values: DurationLikeObject): Duration; | ||
set(values: DurationLikeObject): this; | ||
@@ -393,3 +395,3 @@ /** | ||
*/ | ||
reconfigure(opts?: DurationOptions): Duration; | ||
reconfigure(opts?: DurationOptions): this; | ||
@@ -408,3 +410,3 @@ /** | ||
*/ | ||
as(unit: DurationUnit): number | IfInvalid<typeof NaN>; | ||
as(unit: DurationUnit): IfValid<number, typeof NaN, IsValid>; | ||
@@ -419,3 +421,3 @@ /** | ||
*/ | ||
normalize(): Duration; | ||
normalize(): this; | ||
@@ -428,3 +430,3 @@ /** | ||
*/ | ||
rescale(): Duration; | ||
rescale(): this; | ||
@@ -437,3 +439,3 @@ /** | ||
*/ | ||
shiftTo(...units: DurationUnit[]): Duration; | ||
shiftTo(...units: DurationUnit[]): this; | ||
@@ -444,3 +446,3 @@ /** | ||
*/ | ||
shiftToAll(): Duration; | ||
shiftToAll(): this; | ||
@@ -453,3 +455,3 @@ /** | ||
*/ | ||
negate(): Duration; | ||
negate(): this; | ||
@@ -459,3 +461,3 @@ /** | ||
*/ | ||
get years(): number | IfInvalid<typeof NaN>; | ||
get years(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -465,3 +467,3 @@ /** | ||
*/ | ||
get quarters(): number | IfInvalid<typeof NaN>; | ||
get quarters(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -471,3 +473,3 @@ /** | ||
*/ | ||
get months(): number | IfInvalid<typeof NaN>; | ||
get months(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -477,3 +479,3 @@ /** | ||
*/ | ||
get weeks(): number | IfInvalid<typeof NaN>; | ||
get weeks(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -483,3 +485,3 @@ /** | ||
*/ | ||
get days(): number | IfInvalid<typeof NaN>; | ||
get days(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -489,3 +491,3 @@ /** | ||
*/ | ||
get hours(): number | IfInvalid<typeof NaN>; | ||
get hours(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -495,3 +497,3 @@ /** | ||
*/ | ||
get minutes(): number | IfInvalid<typeof NaN>; | ||
get minutes(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -501,3 +503,3 @@ /** | ||
*/ | ||
get seconds(): number | IfInvalid<typeof NaN>; | ||
get seconds(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -507,3 +509,3 @@ /** | ||
*/ | ||
get milliseconds(): number | IfInvalid<typeof NaN>; | ||
get milliseconds(): IfValid<number, typeof NaN, IsValid>; | ||
@@ -514,3 +516,3 @@ /** | ||
*/ | ||
get isValid(): boolean; | ||
get isValid(): IfValid<true, false, IsValid>; | ||
@@ -520,3 +522,3 @@ /** | ||
*/ | ||
get invalidReason(): string | null; | ||
get invalidReason(): IfValid<string, null, IsValid>; | ||
@@ -526,3 +528,3 @@ /** | ||
*/ | ||
get invalidExplanation(): string | null; | ||
get invalidExplanation(): IfValid<string | null, null, IsValid>; | ||
@@ -533,3 +535,3 @@ /** | ||
*/ | ||
equals(other: Duration): boolean | IfInvalid<false>; | ||
equals(other: Duration): IfValid<boolean, false, IsValid>; | ||
} |
@@ -1,4 +0,4 @@ | ||
import { IfInvalid } from "./_util"; | ||
import { CanBeInvalid, DefaultValidity, IfValid, Invalid, Valid } from "./_util"; | ||
import { DateObjectUnits, DateTime, DateTimeOptions, DiffOptions, LocaleOptions, ToISOTimeOptions } from "./datetime"; | ||
import { Duration, DurationLike, DurationUnit } from "./duration"; | ||
import { Duration, DurationLike, DurationMaybeValid, DurationUnit } from "./duration"; | ||
@@ -12,2 +12,4 @@ export interface IntervalObject { | ||
export type IntervalMaybeValid = CanBeInvalid extends true ? (Interval<Valid> | Interval<Invalid>) : Interval; | ||
/** | ||
@@ -30,3 +32,3 @@ * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. | ||
*/ | ||
export class Interval { | ||
export class Interval<IsValid extends boolean = DefaultValidity> { | ||
/** | ||
@@ -38,3 +40,3 @@ * Create an invalid Interval. | ||
*/ | ||
static invalid(reason: string, explanation?: string): Interval; | ||
static invalid(reason: string, explanation?: string): Interval<Invalid>; | ||
@@ -47,3 +49,3 @@ /** | ||
*/ | ||
static fromDateTimes(start: DateInput, end: DateInput): Interval; | ||
static fromDateTimes(start: DateInput, end: DateInput): IntervalMaybeValid; | ||
@@ -56,3 +58,3 @@ /** | ||
*/ | ||
static after(start: DateInput, duration: DurationLike): Interval; | ||
static after(start: DateInput, duration: DurationLike): IntervalMaybeValid; | ||
@@ -65,3 +67,3 @@ /** | ||
*/ | ||
static before(end: DateInput, duration: DurationLike): Interval; | ||
static before(end: DateInput, duration: DurationLike): IntervalMaybeValid; | ||
@@ -76,3 +78,3 @@ /** | ||
*/ | ||
static fromISO(text: string, opts?: DateTimeOptions): Interval; | ||
static fromISO(text: string, opts?: DateTimeOptions): IntervalMaybeValid; | ||
@@ -84,3 +86,3 @@ /** | ||
*/ | ||
static isInterval(o: unknown): o is Interval; | ||
static isInterval(o: unknown): o is IntervalMaybeValid; | ||
@@ -92,3 +94,3 @@ private constructor(config: unknown); | ||
*/ | ||
get start(): DateTime | IfInvalid<null>; | ||
get start(): IfValid<DateTime<Valid>, null, IsValid>; | ||
@@ -98,3 +100,3 @@ /** | ||
*/ | ||
get end(): DateTime | IfInvalid<null>; | ||
get end(): IfValid<DateTime<Valid>, null, IsValid>; | ||
@@ -104,3 +106,3 @@ /** | ||
*/ | ||
get isValid(): boolean; | ||
get isValid(): IfValid<true, false, IsValid>; | ||
@@ -110,3 +112,3 @@ /** | ||
*/ | ||
get invalidReason(): string | null; | ||
get invalidReason(): IfValid<string, null, IsValid>; | ||
@@ -116,3 +118,3 @@ /** | ||
*/ | ||
get invalidExplanation(): string | null; | ||
get invalidExplanation(): IfValid<string | null, null, IsValid>; | ||
@@ -124,3 +126,3 @@ /** | ||
*/ | ||
length(unit?: DurationUnit): number | IfInvalid<typeof NaN>; | ||
length(unit?: DurationUnit): IfValid<number, typeof NaN, IsValid>; | ||
@@ -134,3 +136,3 @@ /** | ||
*/ | ||
count(unit?: DurationUnit): number | IfInvalid<typeof NaN>; | ||
count(unit?: DurationUnit): IfValid<number, typeof NaN, IsValid>; | ||
@@ -142,3 +144,3 @@ /** | ||
*/ | ||
hasSame(unit: DurationUnit): boolean | IfInvalid<false>; | ||
hasSame(unit: DurationUnit): IfValid<boolean, false, IsValid>; | ||
@@ -155,3 +157,3 @@ /** | ||
*/ | ||
isAfter(dateTime: DateTime): boolean | IfInvalid<false>; | ||
isAfter(dateTime: DateTime): IfValid<boolean, false, IsValid>; | ||
@@ -163,3 +165,3 @@ /** | ||
*/ | ||
isBefore(dateTime: DateTime): boolean | IfInvalid<false>; | ||
isBefore(dateTime: DateTime): IfValid<boolean, false, IsValid>; | ||
@@ -171,3 +173,3 @@ /** | ||
*/ | ||
contains(dateTime: DateTime): boolean | IfInvalid<false>; | ||
contains(dateTime: DateTime): IfValid<boolean, false, IsValid>; | ||
@@ -181,3 +183,3 @@ /** | ||
*/ | ||
set(values?: IntervalObject): Interval; | ||
set(values?: IntervalObject): IntervalMaybeValid; | ||
@@ -189,3 +191,3 @@ /** | ||
*/ | ||
splitAt(...dateTimes: DateTime[]): Interval[] | IfInvalid<[]>; | ||
splitAt(...dateTimes: DateTime[]): IfValid<Interval[], [], IsValid>; | ||
@@ -198,3 +200,3 @@ /** | ||
*/ | ||
splitBy(duration: DurationLike): Interval[] | IfInvalid<[]>; | ||
splitBy(duration: DurationLike): IfValid<Interval[], [], IsValid>; | ||
@@ -206,3 +208,3 @@ /** | ||
*/ | ||
divideEqually(numberOfParts: number): Interval[] | IfInvalid<[]>; | ||
divideEqually(numberOfParts: number): IfValid<Interval[], [], IsValid>; | ||
@@ -217,3 +219,3 @@ /** | ||
*/ | ||
abutsStart(other: Interval): boolean | IfInvalid<false>; | ||
abutsStart(other: Interval): IfValid<boolean, false, IsValid>; | ||
@@ -223,3 +225,3 @@ /** | ||
*/ | ||
abutsEnd(other: Interval): boolean | IfInvalid<false>; | ||
abutsEnd(other: Interval): IfValid<boolean, false, IsValid>; | ||
@@ -229,3 +231,3 @@ /** | ||
*/ | ||
engulfs(other: Interval): boolean | IfInvalid<false>; | ||
engulfs(other: Interval): IfValid<boolean, false, IsValid>; | ||
@@ -235,3 +237,3 @@ /** | ||
*/ | ||
equals(other: Interval): boolean | IfInvalid<false>; | ||
equals(other: Interval): IfValid<boolean, false, IsValid>; | ||
@@ -249,3 +251,3 @@ /** | ||
*/ | ||
union(other: Interval): Interval; | ||
union(other: Interval): IntervalMaybeValid; | ||
@@ -256,3 +258,3 @@ /** | ||
*/ | ||
static merge(intervals: Interval[]): Interval[]; | ||
static merge(intervals: Interval[]): IntervalMaybeValid[]; | ||
@@ -262,3 +264,3 @@ /** | ||
*/ | ||
static xor(intervals: Interval[]): Interval[]; | ||
static xor(intervals: Interval[]): IntervalMaybeValid[]; | ||
@@ -268,3 +270,3 @@ /** | ||
*/ | ||
difference(...intervals: Interval[]): Interval[]; | ||
difference(...intervals: Interval[]): IntervalMaybeValid[]; | ||
@@ -274,3 +276,3 @@ /** | ||
*/ | ||
toString(): string | IfInvalid<"Invalid Interval">; | ||
toString(): IfValid<string, "Invalid Interval", IsValid>; | ||
@@ -308,3 +310,3 @@ /** | ||
opts?: LocaleOptions, | ||
): string | IfInvalid<"Invalid Interval">; | ||
): IfValid<string, "Invalid Interval", IsValid>; | ||
@@ -317,3 +319,3 @@ /** | ||
*/ | ||
toISO(opts?: ToISOTimeOptions): string | IfInvalid<"Invalid Interval">; | ||
toISO(opts?: ToISOTimeOptions): IfValid<string, "Invalid Interval", IsValid>; | ||
@@ -325,3 +327,3 @@ /** | ||
*/ | ||
toISODate(): string | IfInvalid<"Invalid Interval">; | ||
toISODate(): IfValid<string, "Invalid Interval", IsValid>; | ||
@@ -335,3 +337,3 @@ /** | ||
*/ | ||
toISOTime(opts?: ToISOTimeOptions): string | IfInvalid<"Invalid Interval">; | ||
toISOTime(opts?: ToISOTimeOptions): IfValid<string, "Invalid Interval", IsValid>; | ||
@@ -350,3 +352,3 @@ /** | ||
}, | ||
): string | IfInvalid<"Invalid Interval">; | ||
): IfValid<string, "Invalid Interval", IsValid>; | ||
@@ -371,3 +373,3 @@ /** | ||
*/ | ||
toDuration(unit?: DurationUnit | DurationUnit[], opts?: DiffOptions): Duration; | ||
toDuration(unit?: DurationUnit | DurationUnit[], opts?: DiffOptions): DurationMaybeValid; | ||
@@ -382,3 +384,3 @@ /** | ||
*/ | ||
mapEndpoints(mapFn: (d: DateTime) => DateTime): Interval; | ||
mapEndpoints(mapFn: (d: DateTime) => DateTime): IntervalMaybeValid; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Zone } from "./zone"; | ||
import { Zone, ZoneMaybeValid } from "./zone"; | ||
@@ -27,3 +27,3 @@ /** | ||
*/ | ||
static get defaultZone(): Zone; | ||
static get defaultZone(): ZoneMaybeValid; | ||
static set defaultZone(zone: Zone | string); | ||
@@ -30,0 +30,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { IfInvalid } from "./_util"; | ||
import { CanBeInvalid, DefaultValidity, IfValid } from "./_util"; | ||
@@ -20,7 +20,9 @@ export interface ZoneOffsetOptions { | ||
export abstract class Zone { | ||
export type ZoneMaybeValid = CanBeInvalid extends true ? Zone<true> | Zone<false> : Zone; | ||
export abstract class Zone<IsValid extends boolean = DefaultValidity> { | ||
/** | ||
* The type of zone | ||
*/ | ||
get type(): string | IfInvalid<"invalid">; | ||
get type(): IfValid<string, "invalid", IsValid>; | ||
@@ -35,3 +37,3 @@ /** | ||
*/ | ||
get isUniversal(): boolean | IfInvalid<false>; | ||
get isUniversal(): IfValid<boolean, false, IsValid>; | ||
@@ -46,3 +48,3 @@ /** | ||
*/ | ||
offsetName(ts: number, options: ZoneOffsetOptions): string | IfInvalid<null>; | ||
offsetName(ts: number, options: ZoneOffsetOptions): IfValid<string, null, IsValid>; | ||
@@ -56,3 +58,3 @@ /** | ||
*/ | ||
formatOffset(ts: number, format: ZoneOffsetFormat): string | IfInvalid<"">; | ||
formatOffset(ts: number, format: ZoneOffsetFormat): IfValid<string, "", IsValid>; | ||
@@ -64,3 +66,3 @@ /** | ||
*/ | ||
offset(ts: number): number | IfInvalid<typeof NaN>; | ||
offset(ts: number): IfValid<number, typeof NaN, IsValid>; | ||
@@ -72,3 +74,3 @@ /** | ||
*/ | ||
equals(other: Zone): boolean | IfInvalid<false>; | ||
equals(other: Zone): IfValid<boolean, false, IsValid>; | ||
@@ -78,3 +80,3 @@ /** | ||
*/ | ||
get isValid(): boolean | IfInvalid<false>; | ||
get isValid(): IfValid<true, false, IsValid>; | ||
} | ||
@@ -85,7 +87,7 @@ | ||
*/ | ||
export class IANAZone extends Zone { | ||
export class IANAZone<IsValid extends boolean = DefaultValidity> extends Zone<IsValid> { | ||
/** | ||
* Same as constructor but has caching. | ||
*/ | ||
static create(name: string): IANAZone; | ||
static create(name: string): CanBeInvalid extends true ? (IANAZone<true> | IANAZone<false>) : IANAZone; | ||
@@ -128,4 +130,2 @@ /** | ||
constructor(name: string); | ||
get isValid(): true; | ||
} | ||
@@ -136,3 +136,3 @@ | ||
*/ | ||
export class FixedOffsetZone extends Zone { | ||
export class FixedOffsetZone extends Zone<true> { | ||
/** | ||
@@ -163,4 +163,2 @@ * Get a singleton instance of UTC | ||
static parseSpecifier(s: string): FixedOffsetZone; | ||
get isValid(): true; | ||
} | ||
@@ -171,7 +169,6 @@ | ||
*/ | ||
export class InvalidZone extends Zone { | ||
export class InvalidZone extends Zone<false> { | ||
get type(): "invalid"; | ||
get isUniversal(): false; | ||
get offsetFormat(): ""; | ||
get isValid(): false; | ||
} | ||
@@ -182,3 +179,3 @@ | ||
*/ | ||
export class SystemZone extends Zone { | ||
export class SystemZone extends Zone<true> { | ||
/** | ||
@@ -188,4 +185,2 @@ * Get a singleton instance of the system zone | ||
static get instance(): SystemZone; | ||
get isValid(): true; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
115585
2721