fix: async route typing (#1510)

This commit is contained in:
Asher Gomez
2023-07-24 08:22:48 +00:00
committed by GitHub
parent 9cae8fdd5c
commit 0b96db4bae
+7 -5
View File
@@ -135,13 +135,15 @@ export interface RouteModule {
config?: RouteConfig; config?: RouteConfig;
} }
export type AsyncRoute<T> = ( // deno-lint-ignore no-explicit-any
export type AsyncRoute<T = any, S = Record<string, unknown>> = (
req: Request, req: Request,
ctx: RouteContext<T>, ctx: RouteContext<T, S>,
) => Promise<ComponentChildren | Response>; ) => Promise<ComponentChildren | Response>;
export type PageComponent<T> = // deno-lint-ignore no-explicit-any
| ComponentType<PageProps<T>> export type PageComponent<T = any, S = Record<string, unknown>> =
| AsyncRoute<T> | ComponentType<PageProps<T, S>>
| AsyncRoute<T, S>
// deno-lint-ignore no-explicit-any // deno-lint-ignore no-explicit-any
| ((props: any) => VNode<any> | ComponentChildren); | ((props: any) => VNode<any> | ComponentChildren);