Skip to content

Commit 210c002

Browse files
update deno serve documentation to mention the satisfies type (#1673)
1 parent 870d5dd commit 210c002

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

runtime/reference/cli/serve.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ export default {
1717
async fetch(_req) {
1818
return new Response("Hello world!");
1919
},
20-
};
20+
} satisfies Deno.ServeDefaultExport;
2121
```
2222

23+
The `satisfies Deno.ServeDefaultExport` type assertion ensures that your
24+
exported object conforms to the expected interface for Deno's HTTP server. This
25+
provides type safety and better editor autocomplete while allowing you to
26+
maintain the inferred types of your implementation.
27+
2328
You can then run the server using the `deno serve` command:
2429

2530
```bash
@@ -38,5 +43,5 @@ export default {
3843

3944
return new Response("Hello world!");
4045
},
41-
};
46+
} satisfies Deno.ServeDefaultExport;
4247
```

0 commit comments

Comments
 (0)