Skip to content

Commit b6934a5

Browse files
committed
fix(node:timers): add missing methods to Timeout polyfill
1 parent 5f58e4d commit b6934a5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/runtime/node/internal/timers/set-interval.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Timeout } from "./timeout.ts";
33
export async function* setIntervalFallbackPromises<T = void>(
44
delay?: number,
55
value?: T,
6-
): AsyncIterable<T> {
6+
): NodeJS.AsyncIterator<T> {
77
yield value as T;
88
}
99

src/runtime/node/internal/timers/timeout.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
import { createNotImplementedError } from "../../../_internal/utils.ts";
2+
13
export class Timeout<TArgs extends any[]> implements NodeJS.Timeout {
24
constructor(callback: TimerHandler, args: TArgs) {
35
if (typeof callback === "function") {
46
callback(...args);
57
}
68
}
9+
close(): this {
10+
throw createNotImplementedError("node.timers.timeout.close");
11+
}
12+
_onTimeout(...args: any[]): void {
13+
throw createNotImplementedError("node.timers.timeout._onTimeout");
14+
}
715
ref() {
816
return this;
917
}

0 commit comments

Comments
 (0)