summaryrefslogtreecommitdiff
path: root/cli/tsc
diff options
context:
space:
mode:
authorKenta Moriuchi <moriken@kimamass.com>2024-09-11 06:36:43 +0900
committerGitHub <noreply@github.com>2024-09-10 21:36:43 +0000
commite522f4b65a3439030506733b104498f21422ede0 (patch)
treefdc344f8c28aefe387d5c8048e01d0a2240bc8e5 /cli/tsc
parenta69b1e699ef76568a4a3da47939134abda545ec7 (diff)
BREAKING(temporal/unstable): Remove obsoleted Temporal APIs part 2 (#25505)
Mainly I removed `Temporal.Calendar` and `Temporal.TimeZone` and replaced them to APIs that handle calendar and timezone as strings. https://github.com/tc39/proposal-temporal/pull/2925 Related #24836
Diffstat (limited to 'cli/tsc')
-rw-r--r--cli/tsc/dts/lib.deno.unstable.d.ts508
1 files changed, 13 insertions, 495 deletions
diff --git a/cli/tsc/dts/lib.deno.unstable.d.ts b/cli/tsc/dts/lib.deno.unstable.d.ts
index b826aa1f7..25b3fde9e 100644
--- a/cli/tsc/dts/lib.deno.unstable.d.ts
+++ b/cli/tsc/dts/lib.deno.unstable.d.ts
@@ -2067,8 +2067,7 @@ declare namespace Temporal {
};
/**
- * Options to control behavior of `Duration.compare()`, `Duration.add()`, and
- * `Duration.subtract()`
+ * Options to control behavior of `Duration.compare()`
*
* @category Temporal
* @experimental
@@ -2271,9 +2270,6 @@ declare namespace Temporal {
| "nanosecond"
>,
): Temporal.Instant;
- toZonedDateTime(
- calendarAndTimeZone: { timeZone: TimeZoneLike; calendar: CalendarLike },
- ): Temporal.ZonedDateTime;
toZonedDateTimeISO(tzLike: TimeZoneLike): Temporal.ZonedDateTime;
toLocaleString(
locales?: string | string[],
@@ -2286,188 +2282,13 @@ declare namespace Temporal {
}
/**
- * @category Temporal
- * @experimental
- */
- export type YearOrEraAndEraYear = { era: string; eraYear: number } | {
- year: number;
- };
- /**
- * @category Temporal
- * @experimental
- */
- export type MonthCodeOrMonthAndYear =
- | (YearOrEraAndEraYear & { month: number })
- | {
- monthCode: string;
- };
- /**
- * @category Temporal
- * @experimental
- */
- export type MonthOrMonthCode = { month: number } | { monthCode: string };
-
- /**
- * @category Temporal
- * @experimental
- */
- export interface CalendarProtocol {
- id: string;
- year(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | Temporal.PlainYearMonth
- | PlainDateLike
- | string,
- ): number;
- month(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | Temporal.PlainYearMonth
- | Temporal.PlainMonthDay
- | PlainDateLike
- | string,
- ): number;
- monthCode(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | Temporal.PlainYearMonth
- | Temporal.PlainMonthDay
- | PlainDateLike
- | string,
- ): string;
- day(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | Temporal.PlainMonthDay
- | PlainDateLike
- | string,
- ): number;
- era(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | PlainDateLike
- | string,
- ): string | undefined;
- eraYear(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | PlainDateLike
- | string,
- ): number | undefined;
- dayOfWeek(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | PlainDateLike
- | string,
- ): number;
- dayOfYear(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | PlainDateLike
- | string,
- ): number;
- weekOfYear(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | PlainDateLike
- | string,
- ): number | undefined;
- yearOfWeek(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | PlainDateLike
- | string,
- ): number | undefined;
- daysInWeek(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | PlainDateLike
- | string,
- ): number;
- daysInMonth(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | Temporal.PlainYearMonth
- | PlainDateLike
- | string,
- ): number;
- daysInYear(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | Temporal.PlainYearMonth
- | PlainDateLike
- | string,
- ): number;
- monthsInYear(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | Temporal.PlainYearMonth
- | PlainDateLike
- | string,
- ): number;
- inLeapYear(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | Temporal.PlainYearMonth
- | PlainDateLike
- | string,
- ): boolean;
- dateFromFields(
- fields: YearOrEraAndEraYear & MonthOrMonthCode & { day: number },
- options?: AssignmentOptions,
- ): Temporal.PlainDate;
- yearMonthFromFields(
- fields: YearOrEraAndEraYear & MonthOrMonthCode,
- options?: AssignmentOptions,
- ): Temporal.PlainYearMonth;
- monthDayFromFields(
- fields: MonthCodeOrMonthAndYear & { day: number },
- options?: AssignmentOptions,
- ): Temporal.PlainMonthDay;
- dateAdd(
- date: Temporal.PlainDate | PlainDateLike | string,
- duration: Temporal.Duration | DurationLike | string,
- options?: ArithmeticOptions,
- ): Temporal.PlainDate;
- dateUntil(
- one: Temporal.PlainDate | PlainDateLike | string,
- two: Temporal.PlainDate | PlainDateLike | string,
- options?: DifferenceOptions<"year" | "month" | "week" | "day">,
- ): Temporal.Duration;
- fields(fields: Iterable<string>): Iterable<string>;
- mergeFields(
- fields: Record<string, unknown>,
- additionalFields: Record<string, unknown>,
- ): Record<string, unknown>;
- toString?(): string;
- toJSON?(): string;
- }
-
- /**
- * Any of these types can be passed to Temporal methods instead of a Temporal.Calendar.
+ * Any of these types can be passed to Temporal methods instead of a calendar ID.
*
* @category Temporal
* @experimental
*/
export type CalendarLike =
| string
- | CalendarProtocol
| ZonedDateTime
| PlainDateTime
| PlainDate
@@ -2475,168 +2296,6 @@ declare namespace Temporal {
| PlainMonthDay;
/**
- * A `Temporal.Calendar` is a representation of a calendar system. It includes
- * information about how many days are in each year, how many months are in
- * each year, how many days are in each month, and how to do arithmetic in
- * that calendar system.
- *
- * See https://tc39.es/proposal-temporal/docs/calendar.html for more details.
- *
- * @category Temporal
- * @experimental
- */
- export class Calendar implements CalendarProtocol {
- static from(item: CalendarLike): Temporal.Calendar | CalendarProtocol;
- constructor(calendarIdentifier: string);
- readonly id: string;
- year(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | Temporal.PlainYearMonth
- | PlainDateLike
- | string,
- ): number;
- month(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | Temporal.PlainYearMonth
- | Temporal.PlainMonthDay
- | PlainDateLike
- | string,
- ): number;
- monthCode(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | Temporal.PlainYearMonth
- | Temporal.PlainMonthDay
- | PlainDateLike
- | string,
- ): string;
- day(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | Temporal.PlainMonthDay
- | PlainDateLike
- | string,
- ): number;
- era(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | PlainDateLike
- | string,
- ): string | undefined;
- eraYear(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | PlainDateLike
- | string,
- ): number | undefined;
- dayOfWeek(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | PlainDateLike
- | string,
- ): number;
- dayOfYear(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | PlainDateLike
- | string,
- ): number;
- weekOfYear(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | PlainDateLike
- | string,
- ): number | undefined;
- yearOfWeek(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | PlainDateLike
- | string,
- ): number | undefined;
- daysInWeek(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | PlainDateLike
- | string,
- ): number;
- daysInMonth(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | Temporal.PlainYearMonth
- | PlainDateLike
- | string,
- ): number;
- daysInYear(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | Temporal.PlainYearMonth
- | PlainDateLike
- | string,
- ): number;
- monthsInYear(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | Temporal.PlainYearMonth
- | PlainDateLike
- | string,
- ): number;
- inLeapYear(
- date:
- | Temporal.PlainDate
- | Temporal.PlainDateTime
- | Temporal.PlainYearMonth
- | PlainDateLike
- | string,
- ): boolean;
- dateFromFields(
- fields: YearOrEraAndEraYear & MonthOrMonthCode & { day: number },
- options?: AssignmentOptions,
- ): Temporal.PlainDate;
- yearMonthFromFields(
- fields: YearOrEraAndEraYear & MonthOrMonthCode,
- options?: AssignmentOptions,
- ): Temporal.PlainYearMonth;
- monthDayFromFields(
- fields: MonthCodeOrMonthAndYear & { day: number },
- options?: AssignmentOptions,
- ): Temporal.PlainMonthDay;
- dateAdd(
- date: Temporal.PlainDate | PlainDateLike | string,
- duration: Temporal.Duration | DurationLike | string,
- options?: ArithmeticOptions,
- ): Temporal.PlainDate;
- dateUntil(
- one: Temporal.PlainDate | PlainDateLike | string,
- two: Temporal.PlainDate | PlainDateLike | string,
- options?: DifferenceOptions<"year" | "month" | "week" | "day">,
- ): Temporal.Duration;
- fields(fields: Iterable<string>): string[];
- mergeFields(
- fields: Record<string, unknown>,
- additionalFields: Record<string, unknown>,
- ): Record<string, unknown>;
- toString(): string;
- toJSON(): string;
- readonly [Symbol.toStringTag]: "Temporal.Calendar";
- }
-
- /**
* @category Temporal
* @experimental
*/
@@ -2651,17 +2310,6 @@ declare namespace Temporal {
};
/**
- * @category Temporal
- * @experimental
- */
- export type PlainDateISOFields = {
- isoYear: number;
- isoMonth: number;
- isoDay: number;
- calendar: string | CalendarProtocol;
- };
-
- /**
* A `Temporal.PlainDate` represents a calendar date. "Calendar date" refers to the
* concept of a date as expressed in everyday usage, independent of any time
* zone. For example, it could be used to represent an event on a calendar
@@ -2686,7 +2334,7 @@ declare namespace Temporal {
isoYear: number,
isoMonth: number,
isoDay: number,
- calendar?: CalendarLike,
+ calendar?: string,
);
readonly era: string | undefined;
readonly eraYear: number | undefined;
@@ -2731,7 +2379,6 @@ declare namespace Temporal {
): Temporal.PlainDateTime;
toZonedDateTime(
timeZoneAndTime:
- | TimeZoneProtocol
| string
| {
timeZone: TimeZoneLike;
@@ -2740,7 +2387,6 @@ declare namespace Temporal {
): Temporal.ZonedDateTime;
toPlainYearMonth(): Temporal.PlainYearMonth;
toPlainMonthDay(): Temporal.PlainMonthDay;
- getISOFields(): PlainDateISOFields;
toLocaleString(
locales?: string | string[],
options?: Intl.DateTimeFormatOptions,
@@ -2772,23 +2418,6 @@ declare namespace Temporal {
};
/**
- * @category Temporal
- * @experimental
- */
- export type PlainDateTimeISOFields = {
- isoYear: number;
- isoMonth: number;
- isoDay: number;
- isoHour: number;
- isoMinute: number;
- isoSecond: number;
- isoMillisecond: number;
- isoMicrosecond: number;
- isoNanosecond: number;
- calendar: string | CalendarProtocol;
- };
-
- /**
* A `Temporal.PlainDateTime` represents a calendar date and wall-clock time, with
* a precision in nanoseconds, and without any time zone. Of the Temporal
* classes carrying human-readable time information, it is the most general
@@ -2820,7 +2449,7 @@ declare namespace Temporal {
millisecond?: number,
microsecond?: number,
nanosecond?: number,
- calendar?: CalendarLike,
+ calendar?: string,
);
readonly era: string | undefined;
readonly eraYear: number | undefined;
@@ -2908,7 +2537,6 @@ declare namespace Temporal {
): Temporal.ZonedDateTime;
toPlainDate(): Temporal.PlainDate;
toPlainTime(): Temporal.PlainTime;
- getISOFields(): PlainDateTimeISOFields;
toLocaleString(
locales?: string | string[],
options?: Intl.DateTimeFormatOptions,
@@ -2951,7 +2579,7 @@ declare namespace Temporal {
constructor(
isoMonth: number,
isoDay: number,
- calendar?: CalendarLike,
+ calendar?: string,
referenceISOYear?: number,
);
readonly monthCode: string;
@@ -2963,7 +2591,6 @@ declare namespace Temporal {
options?: AssignmentOptions,
): Temporal.PlainMonthDay;
toPlainDate(year: { year: number }): Temporal.PlainDate;
- getISOFields(): PlainDateISOFields;
toLocaleString(
locales?: string | string[],
options?: Intl.DateTimeFormatOptions,
@@ -2988,19 +2615,6 @@ declare namespace Temporal {
};
/**
- * @category Temporal
- * @experimental
- */
- export type PlainTimeISOFields = {
- isoHour: number;
- isoMinute: number;
- isoSecond: number;
- isoMillisecond: number;
- isoMicrosecond: number;
- isoNanosecond: number;
- };
-
- /**
* A `Temporal.PlainTime` represents a wall-clock time, with a precision in
* nanoseconds, and without any time zone. "Wall-clock time" refers to the
* concept of a time as expressed in everyday usage — the time that you read
@@ -3086,7 +2700,6 @@ declare namespace Temporal {
| "nanosecond"
>,
): Temporal.PlainTime;
- getISOFields(): PlainTimeISOFields;
toLocaleString(
locales?: string | string[],
options?: Intl.DateTimeFormatOptions,
@@ -3098,76 +2711,12 @@ declare namespace Temporal {
}
/**
- * A plain object implementing the protocol for a custom time zone.
- *
- * @category Temporal
- * @experimental
- */
- export interface TimeZoneProtocol {
- id: string;
- getOffsetNanosecondsFor(instant: Temporal.Instant | string): number;
- getOffsetStringFor?(instant: Temporal.Instant | string): string;
- getPlainDateTimeFor?(
- instant: Temporal.Instant | string,
- calendar?: CalendarLike,
- ): Temporal.PlainDateTime;
- getInstantFor?(
- dateTime: Temporal.PlainDateTime | PlainDateTimeLike | string,
- options?: ToInstantOptions,
- ): Temporal.Instant;
- getPossibleInstantsFor(
- dateTime: Temporal.PlainDateTime | PlainDateTimeLike | string,
- ): Temporal.Instant[];
- toString?(): string;
- toJSON?(): string;
- }
-
- /**
- * Any of these types can be passed to Temporal methods instead of a Temporal.TimeZone.
+ * Any of these types can be passed to Temporal methods instead of a time zone ID.
*
* @category Temporal
* @experimental
*/
- export type TimeZoneLike = string | TimeZoneProtocol | ZonedDateTime;
-
- /**
- * A `Temporal.TimeZone` is a representation of a time zone: either an
- * {@link https://www.iana.org/time-zones|IANA time zone}, including
- * information about the time zone such as the offset between the local time
- * and UTC at a particular time, and daylight saving time (DST) changes; or
- * simply a particular UTC offset with no DST.
- *
- * `Temporal.ZonedDateTime` is the only Temporal type to contain a time zone.
- * Other types, like `Temporal.Instant` and `Temporal.PlainDateTime`, do not
- * contain any time zone information, and a `Temporal.TimeZone` object is
- * required to convert between them.
- *
- * See https://tc39.es/proposal-temporal/docs/timezone.html for more details.
- *
- * @category Temporal
- * @experimental
- */
- export class TimeZone implements TimeZoneProtocol {
- static from(timeZone: TimeZoneLike): Temporal.TimeZone | TimeZoneProtocol;
- constructor(timeZoneIdentifier: string);
- readonly id: string;
- getOffsetNanosecondsFor(instant: Temporal.Instant | string): number;
- getOffsetStringFor(instant: Temporal.Instant | string): string;
- getPlainDateTimeFor(
- instant: Temporal.Instant | string,
- calendar?: CalendarLike,
- ): Temporal.PlainDateTime;
- getInstantFor(
- dateTime: Temporal.PlainDateTime | PlainDateTimeLike | string,
- options?: ToInstantOptions,
- ): Temporal.Instant;
- getPossibleInstantsFor(
- dateTime: Temporal.PlainDateTime | PlainDateTimeLike | string,
- ): Temporal.Instant[];
- toString(): string;
- toJSON(): string;
- readonly [Symbol.toStringTag]: "Temporal.TimeZone";
- }
+ export type TimeZoneLike = string | ZonedDateTime;
/**
* @category Temporal
@@ -3204,7 +2753,7 @@ declare namespace Temporal {
constructor(
isoYear: number,
isoMonth: number,
- calendar?: CalendarLike,
+ calendar?: string,
referenceISODay?: number,
);
readonly era: string | undefined;
@@ -3241,7 +2790,6 @@ declare namespace Temporal {
options?: DifferenceOptions<"year" | "month">,
): Temporal.Duration;
toPlainDate(day: { day: number }): Temporal.PlainDate;
- getISOFields(): PlainDateISOFields;
toLocaleString(
locales?: string | string[],
options?: Intl.DateTimeFormatOptions,
@@ -3278,25 +2826,6 @@ declare namespace Temporal {
* @category Temporal
* @experimental
*/
- export type ZonedDateTimeISOFields = {
- isoYear: number;
- isoMonth: number;
- isoDay: number;
- isoHour: number;
- isoMinute: number;
- isoSecond: number;
- isoMillisecond: number;
- isoMicrosecond: number;
- isoNanosecond: number;
- offset: string;
- timeZone: string | TimeZoneProtocol;
- calendar: string | CalendarProtocol;
- };
-
- /**
- * @category Temporal
- * @experimental
- */
export class ZonedDateTime {
static from(
item: Temporal.ZonedDateTime | ZonedDateTimeLike | string,
@@ -3306,11 +2835,7 @@ declare namespace Temporal {
one: Temporal.ZonedDateTime | ZonedDateTimeLike | string,
two: Temporal.ZonedDateTime | ZonedDateTimeLike | string,
): ComparisonResult;
- constructor(
- epochNanoseconds: bigint,
- timeZone: TimeZoneLike,
- calendar?: CalendarLike,
- );
+ constructor(epochNanoseconds: bigint, timeZone: string, calendar?: string);
readonly era: string | undefined;
readonly eraYear: number | undefined;
readonly year: number;
@@ -3337,9 +2862,7 @@ declare namespace Temporal {
readonly inLeapYear: boolean;
readonly offsetNanoseconds: number;
readonly offset: string;
- readonly epochSeconds: number;
readonly epochMilliseconds: number;
- readonly epochMicroseconds: bigint;
readonly epochNanoseconds: bigint;
equals(other: Temporal.ZonedDateTime | ZonedDateTimeLike | string): boolean;
with(
@@ -3408,7 +2931,6 @@ declare namespace Temporal {
toPlainDateTime(): Temporal.PlainDateTime;
toPlainDate(): Temporal.PlainDate;
toPlainTime(): Temporal.PlainTime;
- getISOFields(): ZonedDateTimeISOFields;
toLocaleString(
locales?: string | string[],
options?: Intl.DateTimeFormatOptions,
@@ -3449,8 +2971,7 @@ declare namespace Temporal {
*
* @param {TimeZoneLike} [tzLike] -
* {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones|IANA time zone identifier}
- * string (e.g. `'Europe/London'`), `Temporal.TimeZone` instance, or an
- * object implementing the time zone protocol. If omitted, the environment's
+ * string (e.g. `'Europe/London'`). If omitted, the environment's
* current time zone will be used.
*/
zonedDateTimeISO: (tzLike?: TimeZoneLike) => Temporal.ZonedDateTime;
@@ -3466,8 +2987,7 @@ declare namespace Temporal {
*
* @param {TimeZoneLike} [tzLike] -
* {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones|IANA time zone identifier}
- * string (e.g. `'Europe/London'`), `Temporal.TimeZone` instance, or an
- * object implementing the time zone protocol. If omitted, the environment's
+ * string (e.g. `'Europe/London'`). If omitted, the environment's
* current time zone will be used.
*/
plainDateTimeISO: (tzLike?: TimeZoneLike) => Temporal.PlainDateTime;
@@ -3478,8 +2998,7 @@ declare namespace Temporal {
*
* @param {TimeZoneLike} [tzLike] -
* {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones|IANA time zone identifier}
- * string (e.g. `'Europe/London'`), `Temporal.TimeZone` instance, or an
- * object implementing the time zone protocol. If omitted, the environment's
+ * string (e.g. `'Europe/London'`). If omitted, the environment's
* current time zone will be used.
*/
plainDateISO: (tzLike?: TimeZoneLike) => Temporal.PlainDate;
@@ -3489,8 +3008,7 @@ declare namespace Temporal {
*
* @param {TimeZoneLike} [tzLike] -
* {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones|IANA time zone identifier}
- * string (e.g. `'Europe/London'`), `Temporal.TimeZone` instance, or an
- * object implementing the time zone protocol. If omitted, the environment's
+ * string (e.g. `'Europe/London'`). If omitted, the environment's
* current time zone will be used.
*/
plainTimeISO: (tzLike?: TimeZoneLike) => Temporal.PlainTime;