Skip to content

Commit 4030bd3

Browse files
committed
refactor: RouteHandler type
1 parent 4e617fe commit 4030bd3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/types/next.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ export type RouteMethodHandler<PathParamsInput, Req, Res> = ((
1212
apiData?: OperationObject,
1313
};
1414

15-
export type RouteHandler<HM extends HttpMethod, PathParamsInput, Req, Res> = {
16-
[key in HM]: RouteMethodHandler<PathParamsInput, Req, Res>;
17-
};
15+
export type RouteHandler<
16+
HM extends HttpMethod,
17+
PathParamsInput,
18+
Req,
19+
Res,
20+
> = Record<
21+
HM,
22+
RouteMethodHandler<PathParamsInput, Req, Res>
23+
>;

0 commit comments

Comments
 (0)