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>;