fix(core): use PageProps instead of FreshContext in define*() compat functions (#3064)
In Fresh 1, define apps used `RouteContext`, which align with `PageProps` in Fresh 2, rather than `FreshContext`. E.g. before this PR, one would get a type error if they tried to use `ctx.Component` within `defineApp()` and now they shouldn't.
This commit is contained in:
+3
-3
@@ -1,5 +1,5 @@
|
||||
import type { ComponentChildren } from "preact";
|
||||
import type { FreshContext } from "./context.ts";
|
||||
import type { FreshContext, PageProps } from "./context.ts";
|
||||
import type { HandlerFn, RouteHandler } from "./handlers.ts";
|
||||
|
||||
/**
|
||||
@@ -45,13 +45,13 @@ export type Handler<T = any, State = Record<string, unknown>> = HandlerFn<
|
||||
|
||||
function defineFn<State>(
|
||||
fn: (
|
||||
ctx: FreshContext<State>,
|
||||
ctx: PageProps<State>,
|
||||
) =>
|
||||
| ComponentChildren
|
||||
| Response
|
||||
| Promise<Response | ComponentChildren>,
|
||||
): (
|
||||
ctx: FreshContext<State>,
|
||||
ctx: PageProps<State>,
|
||||
) =>
|
||||
| ComponentChildren
|
||||
| Response
|
||||
|
||||
Reference in New Issue
Block a user