Skip to content

Commit 3ac664d

Browse files
committed
Expressing Method via IRouter (#1735)
This serves two purposes: - Enforcing constraints on its actual usage in `walkRouting()`, - Should ease adoption of the new `QUERY` method in the future, see: - expressjs/express#5615 - nodejs/node#51562
1 parent 729bf1f commit 3ac664d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/method.ts

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1-
export type Method = "get" | "post" | "put" | "delete" | "patch";
2-
export const methods: Method[] = ["get", "post", "put", "delete", "patch"];
3-
export type AuxMethod = "options";
1+
import type { IRouter } from "express";
2+
3+
export const methods = [
4+
"get",
5+
"post",
6+
"put",
7+
"delete",
8+
"patch",
9+
] satisfies Array<keyof IRouter>;
10+
11+
export type Method = (typeof methods)[number];
12+
13+
export type AuxMethod = Extract<keyof IRouter, "options">;

0 commit comments

Comments
 (0)