Skip to content

Commit cbd261e

Browse files
committed
Fix Temporal.MonthDayLikeObject type
1 parent cdc205d commit cbd261e

File tree

6 files changed

+368
-305
lines changed

6 files changed

+368
-305
lines changed

src/lib/esnext.temporal.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ declare namespace Temporal {
4343
nanoseconds?: number | undefined;
4444
}
4545

46-
interface MonthDayLikeObject extends Omit<DateLikeObject, "era" | "eraYear"> {}
46+
interface MonthDayLikeObject extends DateLikeObject {}
4747

4848
interface TimeLikeObject {
4949
hour?: number | undefined;

tests/baselines/reference/temporal.errors.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
temporal.ts(25,13): error TS2339: Property 'year' does not exist on type 'Instant'.
2-
temporal.ts(1502,8): error TS2339: Property 'month' does not exist on type 'PlainMonthDay'.
3-
temporal.ts(1512,8): error TS2339: Property 'month' does not exist on type 'PlainMonthDay'.
4-
temporal.ts(1518,8): error TS2339: Property 'month' does not exist on type 'PlainMonthDay'.
2+
temporal.ts(1504,8): error TS2339: Property 'month' does not exist on type 'PlainMonthDay'.
3+
temporal.ts(1514,8): error TS2339: Property 'month' does not exist on type 'PlainMonthDay'.
4+
temporal.ts(1520,8): error TS2339: Property 'month' does not exist on type 'PlainMonthDay'.
55

66

77
==== temporal.ts (4 errors) ====
@@ -1503,6 +1503,8 @@ temporal.ts(1518,8): error TS2339: Property 'month' does not exist on type 'Plai
15031503
// => 1970-02-21[u-ca=hebrew]
15041504
md = Temporal.PlainMonthDay.from({ month: 6, day: 15, year: 5779, calendar: "hebrew" });
15051505
// => 1970-02-21[u-ca=hebrew]
1506+
md = Temporal.PlainMonthDay.from({ month: 6, day: 15, era: "am", eraYear: 5779, calendar: "hebrew" });
1507+
// => 1970-02-21[u-ca=hebrew]
15061508
/* WRONG */ md = Temporal.PlainMonthDay.from({ month: 6, day: 15, calendar: "hebrew" });
15071509
// => throws (either year or monthCode is required)
15081510
md = Temporal.PlainMonthDay.from("2019-02-20[u-ca=hebrew]");

tests/baselines/reference/temporal.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,6 +1497,8 @@
14971497
// => 1970-02-21[u-ca=hebrew]
14981498
md = Temporal.PlainMonthDay.from({ month: 6, day: 15, year: 5779, calendar: "hebrew" });
14991499
// => 1970-02-21[u-ca=hebrew]
1500+
md = Temporal.PlainMonthDay.from({ month: 6, day: 15, era: "am", eraYear: 5779, calendar: "hebrew" });
1501+
// => 1970-02-21[u-ca=hebrew]
15001502
/* WRONG */ md = Temporal.PlainMonthDay.from({ month: 6, day: 15, calendar: "hebrew" });
15011503
// => throws (either year or monthCode is required)
15021504
md = Temporal.PlainMonthDay.from("2019-02-20[u-ca=hebrew]");
@@ -3099,6 +3101,8 @@
30993101
// => 1970-02-21[u-ca=hebrew]
31003102
md = Temporal.PlainMonthDay.from({ month: 6, day: 15, year: 5779, calendar: "hebrew" });
31013103
// => 1970-02-21[u-ca=hebrew]
3104+
md = Temporal.PlainMonthDay.from({ month: 6, day: 15, era: "am", eraYear: 5779, calendar: "hebrew" });
3105+
// => 1970-02-21[u-ca=hebrew]
31023106
/* WRONG */ md = Temporal.PlainMonthDay.from({ month: 6, day: 15, calendar: "hebrew" });
31033107
// => throws (either year or monthCode is required)
31043108
md = Temporal.PlainMonthDay.from("2019-02-20[u-ca=hebrew]");

0 commit comments

Comments
 (0)