Skip to content

Commit 831db5f

Browse files
committed
Fix build
1 parent 40a361e commit 831db5f

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/app.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ const config = await readConfig();
6262
// We cannot add it in the polyfills.ts because that file is also used as --require argument for ts-node
6363
// TODO: Remove this once temporal is available in Node.js, see: https://github.com/nodejs/node/issues/57127
6464
if (typeof Date.prototype.toTemporalInstant !== "function") {
65-
Date.prototype.toTemporalInstant = function () {
65+
// biome-ignore lint/suspicious/noExplicitAny: hack
66+
(Date.prototype as any).toTemporalInstant = function () {
6667
return Temporal.Instant.fromEpochMilliseconds(this.getTime());
6768
};
6869
}

src/polyfills.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,24 @@ if (typeof Math.sumPrecise !== "function") {
2626

2727
// https://github.com/tc39/proposal-upsert
2828
if (typeof Map.prototype.getOrInsert === "undefined") {
29-
Map.prototype.getOrInsert = function (key, defaultValue) {
29+
Map.prototype.getOrInsert = function <K, V>(this: Map<K, V>, key: K, defaultValue: V): V {
3030
if (!this.has(key)) {
3131
this.set(key, defaultValue);
3232
}
33-
return this.get(key);
33+
// biome-ignore lint/style/noNonNullAssertion: inserted bevore
34+
return this.get(key)!;
3435
};
3536
}
3637
if (typeof Map.prototype.getOrInsertComputed === "undefined") {
37-
Map.prototype.getOrInsertComputed = function (key, callbackFunction) {
38+
Map.prototype.getOrInsertComputed = function <K, V>(
39+
this: Map<K, V>,
40+
key: K,
41+
callbackFunction: (key: K) => V,
42+
): V {
3843
if (!this.has(key)) {
3944
this.set(key, callbackFunction(key));
4045
}
41-
return this.get(key);
46+
// biome-ignore lint/style/noNonNullAssertion: inserted before
47+
return this.get(key)!;
4248
};
4349
}

0 commit comments

Comments
 (0)