Skip to content

Commit 8188a5d

Browse files
committed
Support strictNullChecks in intrinsics.ts
Previously, GetIntrinsic returned a type that could be `undefined`. That's fixed in this commit. Note that intrinsics.ts may be removed completely in #105; if that PR lands first then we'll remove this commit.
1 parent 7324071 commit 8188a5d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/intrinsicclass.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ interface StandaloneIntrinsics {
3636
'Temporal.Calendar.from': typeof Temporal.Calendar.from;
3737
}
3838
type RegisteredStandaloneIntrinsics = { [key in keyof StandaloneIntrinsics as `%${key}%`]: StandaloneIntrinsics[key] };
39-
const INTRINSICS: Partial<TemporalIntrinsicRegisteredKeys> &
40-
Partial<TemporalIntrinsicPrototypeRegisteredKeys> &
41-
Partial<RegisteredStandaloneIntrinsics> = {};
39+
const INTRINSICS = {} as TemporalIntrinsicRegisteredKeys &
40+
TemporalIntrinsicPrototypeRegisteredKeys &
41+
RegisteredStandaloneIntrinsics;
4242

4343
type customFormatFunction<T> = (
4444
this: T,
@@ -96,13 +96,13 @@ export function MakeIntrinsicClass(
9696
});
9797
}
9898
for (const prop of Object.getOwnPropertyNames(Class)) {
99-
const desc = Object.getOwnPropertyDescriptor(Class, prop);
99+
const desc = Object.getOwnPropertyDescriptor(Class, prop) as PropertyDescriptor;
100100
if (!desc.configurable || !desc.enumerable) continue;
101101
desc.enumerable = false;
102102
Object.defineProperty(Class, prop, desc);
103103
}
104104
for (const prop of Object.getOwnPropertyNames(Class.prototype)) {
105-
const desc = Object.getOwnPropertyDescriptor(Class.prototype, prop);
105+
const desc = Object.getOwnPropertyDescriptor(Class.prototype, prop) as PropertyDescriptor;
106106
if (!desc.configurable || !desc.enumerable) continue;
107107
desc.enumerable = false;
108108
Object.defineProperty(Class.prototype, prop, desc);

0 commit comments

Comments
 (0)