refactor: changed Handlers type to MultiHandler (#1360)
This commit is contained in:
@@ -22,6 +22,7 @@ export type {
|
||||
Handlers,
|
||||
MiddlewareHandler,
|
||||
MiddlewareHandlerContext,
|
||||
MultiHandler,
|
||||
PageProps,
|
||||
Plugin,
|
||||
PluginAsyncRenderContext,
|
||||
|
||||
+8
-3
@@ -102,14 +102,19 @@ export type Handler<T = any, State = Record<string, unknown>> = (
|
||||
) => Response | Promise<Response>;
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
export type Handlers<T = any, State = Record<string, unknown>> = {
|
||||
export type MultiHandler<T = any, State = Record<string, unknown>> = {
|
||||
[K in router.KnownMethod]?: Handler<T, State>;
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated This type has been deprecated and is replaced with MultiHandler type.
|
||||
*/
|
||||
export type Handlers<T> = MultiHandler<T>;
|
||||
|
||||
export interface RouteModule {
|
||||
default?: ComponentType<PageProps>;
|
||||
// deno-lint-ignore no-explicit-any
|
||||
handler?: Handler<any, any> | Handlers<any, any>;
|
||||
handler?: Handler<any, any> | MultiHandler<any, any>;
|
||||
config?: RouteConfig;
|
||||
}
|
||||
|
||||
@@ -119,7 +124,7 @@ export interface Route<Data = any> {
|
||||
url: string;
|
||||
name: string;
|
||||
component?: ComponentType<PageProps<Data>>;
|
||||
handler: Handler<Data> | Handlers<Data>;
|
||||
handler: Handler<Data> | MultiHandler<Data>;
|
||||
csp: boolean;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user