Skip to content

Commit 376a85e

Browse files
committed
Remove unused type-casts.
1 parent 1b768aa commit 376a85e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/instant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export class Instant implements Temporal.Instant {
151151
item = timeZoneProperty;
152152
}
153153
}
154-
const timeZone = ES.ToTemporalTimeZone(item as string | Temporal.TimeZoneProtocol);
154+
const timeZone = ES.ToTemporalTimeZone(item);
155155
const calendar = ES.GetISO8601Calendar();
156156
return ES.CreateTemporalZonedDateTime(GetSlot(this, EPOCHNANOSECONDS), timeZone, calendar);
157157
}

lib/plaindate.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ export class PlainDate implements Temporal.PlainDate {
216216
toZonedDateTime(item: Params['toZonedDateTime'][0]): Return['toZonedDateTime'] {
217217
if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');
218218

219-
let timeZone, temporalTime;
219+
type TimeZoneAndPlainTimeProps = Exclude<typeof item, Temporal.TimeZoneProtocol | string>;
220+
let timeZone: Temporal.TimeZoneProtocol, temporalTime: TimeZoneAndPlainTimeProps['plainTime'];
220221
if (ES.IsObject(item)) {
221222
const timeZoneLike = item.timeZone;
222223
if (timeZoneLike === undefined) {
@@ -225,11 +226,10 @@ export class PlainDate implements Temporal.PlainDate {
225226
// not a TimeZoneProtocol.
226227
// TODO: should we check for that shape to improve on the (bad) error
227228
// message that the caller will get from ToTemporalTimeZone?
228-
timeZone = ES.ToTemporalTimeZone(item as Temporal.TimeZoneProtocol);
229+
timeZone = ES.ToTemporalTimeZone(item);
229230
} else {
230231
timeZone = ES.ToTemporalTimeZone(timeZoneLike);
231-
type TimeZoneAndPlainTimeProps = Exclude<typeof item, Temporal.TimeZoneProtocol>;
232-
temporalTime = (item as TimeZoneAndPlainTimeProps).plainTime;
232+
temporalTime = item.plainTime;
233233
}
234234
} else {
235235
timeZone = ES.ToTemporalTimeZone(item);

0 commit comments

Comments
 (0)