Skip to content

Commit 1c1eb66

Browse files
committed
Don’t crash if Temporal is undefined
1 parent f0332fe commit 1c1eb66

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/estree-util-value-to-estree.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ export function valueToEstree(value: unknown, options: Options = {}): Expression
477477
}
478478

479479
if (
480-
Temporal !== undefined &&
480+
typeof Temporal !== 'undefined' &&
481481
(value instanceof Temporal.Duration ||
482482
value instanceof Temporal.Instant ||
483483
value instanceof Temporal.PlainDate ||
@@ -580,7 +580,7 @@ export function valueToEstree(value: unknown, options: Options = {}): Expression
580580
}
581581
}
582582

583-
if (Temporal !== undefined) {
583+
if (typeof Temporal !== 'undefined') {
584584
if (val instanceof Temporal.Duration) {
585585
return temporalConstructor('Duration', [
586586
val.years,

0 commit comments

Comments
 (0)