Skip to content

Commit 60c878a

Browse files
committed
feat: Method type
1 parent 31741ff commit 60c878a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

resources/js/wayfinder.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ export type QueryParams = Record<
99
| Record<string, string | number | boolean>
1010
>;
1111

12-
export type RouteDefinition<TMethod extends string | string[]> = {
12+
type Method = "get" | "post" | "put" | "delete" | "patch" | "head" | string;
13+
14+
export type RouteDefinition<TMethod extends Method | Method[]> = {
1315
url: string;
14-
} & (TMethod extends string[] ? { methods: TMethod } : { method: TMethod });
16+
} & (TMethod extends Method[] ? { methods: TMethod } : { method: TMethod });
1517

16-
export type RouteFormDefinition<TMethod extends string> = {
18+
export type RouteFormDefinition<TMethod extends Method> = {
1719
action: string;
1820
method: TMethod;
1921
};

0 commit comments

Comments
 (0)