File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
src/content/docs/workers/runtime-apis/nodejs Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,10 @@ and [`setImmediate`](https://nodejs.org/api/timers.html#setimmediatecallback-arg
1818import timers from " node:timers" ;
1919
2020export default {
21- async fetch() {
21+ async fetch(): Promise < Response > {
2222 console .log (" first" );
23- const { promise1, resolve1 } = Promise .withResolvers ();
24- const { promise2, resolve2 } = Promise .withResolvers ();
23+ const { promise : promise1, resolve : resolve1 } = Promise .withResolvers < void > ();
24+ const { promise : promise2, resolve : resolve2 } = Promise .withResolvers < void > ();
2525 timers .setTimeout (() => {
2626 console .log (" last" );
2727 resolve1 ();
@@ -35,10 +35,8 @@ export default {
3535 await Promise .all ([promise1 , promise2 ]);
3636
3737 return new Response (" ok" );
38-
39- }
40- }
41-
38+ }
39+ } satisfies ExportedHandler <Env >;
4240```
4341</TypeScriptExample >
4442
@@ -55,4 +53,3 @@ compatibility, you must call functions from the `node:timers` module.
5553:::
5654
5755The full ` node:timers ` API is documented in the [ Node.js documentation for ` node:timers ` ] ( https://nodejs.org/api/timers.html ) .
58- ```
You can’t perform that action at this time.
0 commit comments