new format wip
This commit is contained in:
+13
-6
@@ -1,11 +1,18 @@
|
||||
import type { RouteList } from "./routelist.ts"
|
||||
// import type { RouteList } from "./routelist.ts";
|
||||
|
||||
type RouteUrl = RouteList[number]["url"];
|
||||
// type RouteUrl = RouteList[number]["url"];
|
||||
|
||||
type HttpMethod = RouteList[number]["method"];
|
||||
// type HttpMethod = RouteList[number]["method"];
|
||||
|
||||
type Route<M extends HttpMethod, U extends RouteUrl> = Extract<RouteList[number], {url: U, method: M}>;
|
||||
// type Route<M extends HttpMethod, U extends RouteUrl> = Extract<
|
||||
// RouteList[number],
|
||||
// { url: U; method: M }
|
||||
// >;
|
||||
|
||||
export type RoutePayload<M extends HttpMethod, U extends RouteUrl> = Parameters<Route<M, U>["handler"]>[0]["payload"];
|
||||
// export type RoutePayload<M extends HttpMethod, U extends RouteUrl> = Parameters<
|
||||
// Route<M, U>["handler"]
|
||||
// >[0]["payload"];
|
||||
|
||||
export type RouteResponse<M extends HttpMethod, U extends RouteUrl> = Awaited<ReturnType<Route<M, U>["handler"]>>;
|
||||
// export type RouteResponse<M extends HttpMethod, U extends RouteUrl> = Awaited<
|
||||
// ReturnType<Route<M, U>["handler"]>
|
||||
// >;
|
||||
|
||||
Reference in New Issue
Block a user