From 2628eb3693bf57e94a3b2a49751f917e53da2301 Mon Sep 17 00:00:00 2001 From: xiongxiao Date: Mon, 2 Mar 2026 04:01:17 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4=E6=9C=AA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E7=B1=BB=E5=9E=8B=E5=AE=9A=E4=B9=89=E5=B9=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=20RouteOpts=20=E7=B1=BB=E5=9E=8B=E4=BB=A5?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=8D=E5=90=88=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/route.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/route.ts b/src/route.ts index 15982e2..56fe20a 100644 --- a/src/route.ts +++ b/src/route.ts @@ -7,14 +7,6 @@ import * as schema from './validator/schema.ts'; export type RouterContextT = { code?: number;[key: string]: any }; -type ExtractArgs = A extends z.ZodTypeAny ? z.infer : A; - -type OptionalKeys = { - [K in keyof T]-?: {} extends Pick ? K : never; -}[keyof T]; - -type MakeOptional = Omit & Partial>; - type BuildRouteContext = M extends { args?: infer A } ? A extends z.ZodObject ? RouteContext<{ args?: z.infer }, U> @@ -103,7 +95,7 @@ export type RouteOpts = { description?: string; metadata?: T; middleware?: RouteMiddleware[]; // middleware - type?: 'route' | 'middleware'; + type?: 'route' | 'middleware' | 'compound'; // compound表示这个 route 作为一个聚合体,没有实际的 run,而是一个 router 的聚合列表 /** * $#$ will be used to split path and key */ @@ -146,8 +138,6 @@ export const createSkill = (skill: Skill): Skill => { export type RouteInfo = Pick; -type ExtractMetadata = M extends { metadata?: infer Meta } ? Meta extends SimpleObject ? Meta : SimpleObject : SimpleObject; - /** * @M 是 route的 metadate的类型,默认是 SimpleObject * @U 是 RouteContext 里 state的类型 @@ -183,7 +173,7 @@ export class Route>;