feat: Allow passing props to renderNotFound method (#1310)

This commit is contained in:
Kamil Ogórek
2023-06-16 17:12:01 +02:00
committed by GitHub
parent 12fc103daa
commit d5a8692b78
5 changed files with 23 additions and 6 deletions
+9 -2
View File
@@ -91,7 +91,7 @@ export interface HandlerContext<Data = unknown, State = Record<string, unknown>>
data?: Data,
options?: RenderOptions,
) => Response | Promise<Response>;
renderNotFound: () => Response | Promise<Response>;
renderNotFound: (data?: Data) => Response | Promise<Response>;
state: State;
}
@@ -135,13 +135,20 @@ export interface AppModule {
// --- UNKNOWN PAGE ---
export interface UnknownPageProps {
// deno-lint-ignore no-explicit-any
export interface UnknownPageProps<T = any> {
/** The URL of the request that resulted in this page being rendered. */
url: URL;
/** The route matcher (e.g. /blog/:id) that the request matched for this page
* to be rendered. */
route: string;
/**
* Additional data passed into `HandlerContext.renderNotFound`. Defaults to
* `undefined`.
*/
data: T;
}
export interface UnknownHandlerContext<State = Record<string, unknown>>