We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Method
1 parent 31741ff commit 60c878aCopy full SHA for 60c878a
resources/js/wayfinder.ts
@@ -9,11 +9,13 @@ export type QueryParams = Record<
9
| Record<string, string | number | boolean>
10
>;
11
12
-export type RouteDefinition<TMethod extends string | string[]> = {
+type Method = "get" | "post" | "put" | "delete" | "patch" | "head" | string;
13
+
14
+export type RouteDefinition<TMethod extends Method | Method[]> = {
15
url: string;
-} & (TMethod extends string[] ? { methods: TMethod } : { method: TMethod });
16
+} & (TMethod extends Method[] ? { methods: TMethod } : { method: TMethod });
17
-export type RouteFormDefinition<TMethod extends string> = {
18
+export type RouteFormDefinition<TMethod extends Method> = {
19
action: string;
20
method: TMethod;
21
};
0 commit comments