Skip to content

Commit d63e577

Browse files
committed
refactor: prettify fixed path params
1 parent 9b1aa87 commit d63e577

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/core/definer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { customErrorTypes } from "~/types/error";
22
import type { HttpMethod } from "~/types/http";
33
import type { RouteHandler, RouteMethodHandler } from "~/types/next";
44
import type { FixPathParams } from "~/types/path-params";
5+
import type { Prettify } from "~/types/prettify";
56
import type { ResponseCollection } from "~/types/response";
67
import { parseRequestBody, resolveRequestBody } from "./body";
78
import { resolveParams } from "./params";
@@ -81,7 +82,7 @@ function defineRoute<
8182
ResDef extends Record<string, unknown>,
8283
>(input: RouteOptions<
8384
M, PPI, PPO, QPI, QPO, RBI, RBO, MwReq, MwRes, ResDef
84-
>): RouteHandler<M, FixPathParams<PPI>, MwReq, MwRes> {
85+
>): RouteHandler<M, Prettify<FixPathParams<PPI>>, MwReq, MwRes> {
8586
const handler: RouteMethodHandler<FixPathParams<PPI>, MwReq, MwRes> = async (request, context) => {
8687
try {
8788
const { searchParams } = new URL(request.url);

src/types/prettify.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export type Prettify<T> = {
2+
[K in keyof T]: T[K];
3+
} & {};

0 commit comments

Comments
 (0)