feat: export compat types from /compat export (#2478)
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
// Compat with older Fresh versions
|
||||
export {
|
||||
type AppProps,
|
||||
defineApp,
|
||||
defineLayout,
|
||||
defineRoute,
|
||||
type ErrorPageProps,
|
||||
type Handler,
|
||||
type Handlers,
|
||||
type LayoutProps,
|
||||
type RouteContext,
|
||||
type UnknownPageProps,
|
||||
} from "./server.ts";
|
||||
+25
-11
@@ -1,33 +1,47 @@
|
||||
import type { VNode } from "preact";
|
||||
import type { FreshContext } from "../context.ts";
|
||||
import type { HandlerByMethod } from "../handlers.ts";
|
||||
import type { HandlerFn, RouteHandler } from "../handlers.ts";
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link FreshContext} instead
|
||||
* @deprecated Use {@link PageProps} instead.
|
||||
*/
|
||||
export type AppProps<_Data = unknown, T = unknown> = FreshContext<T>;
|
||||
/**
|
||||
* @deprecated Use {@link FreshContext} instead
|
||||
* @deprecated Use {@link PageProps} instead.
|
||||
*/
|
||||
export type LayoutProps<_Data = unknown, T = unknown> = FreshContext<T>;
|
||||
/**
|
||||
* @deprecated Use {@link FreshContext} instead
|
||||
* @deprecated Use {@link PageProps} instead.
|
||||
*/
|
||||
export type UnknownPageProps<_Data = unknown, T = unknown> = FreshContext<T>;
|
||||
/**
|
||||
* @deprecated Use {@link FreshContext} instead
|
||||
* @deprecated Use {@link PageProps} instead.
|
||||
*/
|
||||
export type ErrorPageProps<_Data = unknown, T = unknown> = FreshContext<T>;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link FreshContext} instead
|
||||
* @deprecated Use {@link FreshContext} instead.
|
||||
*/
|
||||
export type RouteContext<_T = never, S = Record<string, unknown>> =
|
||||
FreshContext<S>;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link RouteHandler} instead.
|
||||
*/
|
||||
// deno-lint-ignore no-explicit-any
|
||||
export type Handlers<T = any, State = Record<string, unknown>> =
|
||||
HandlerByMethod<T, State>;
|
||||
export type Handlers<T = any, State = Record<string, unknown>> = RouteHandler<
|
||||
T,
|
||||
State
|
||||
>;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link HandlerFn} instead.
|
||||
*/
|
||||
// deno-lint-ignore no-explicit-any
|
||||
export type Handler<T = any, State = Record<string, unknown>> = HandlerFn<
|
||||
T,
|
||||
State
|
||||
>;
|
||||
|
||||
function defineFn<State>(
|
||||
fn: (
|
||||
@@ -40,14 +54,14 @@ function defineFn<State>(
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link definePage} instead
|
||||
* @deprecated Use {@link [../mod.ts].Define.page|define.page} instead.
|
||||
*/
|
||||
export const defineApp = defineFn;
|
||||
/**
|
||||
* @deprecated Use {@link definePage} instead
|
||||
* @deprecated Use {@link [../mod.ts].Define.page|define.page} instead.
|
||||
*/
|
||||
export const defineRoute = defineFn;
|
||||
/**
|
||||
* @deprecated Use {@link definePage} instead
|
||||
* @deprecated Use {@link [../mod.ts].Define.page|define.page} instead.
|
||||
*/
|
||||
export const defineLayout = defineFn;
|
||||
|
||||
-14
@@ -18,17 +18,3 @@ export type { FreshContext, Island, PageProps } from "./context.ts";
|
||||
export { createDefine, type Define } from "./define.ts";
|
||||
export type { Method } from "./router.ts";
|
||||
export { HttpError } from "./error.ts";
|
||||
|
||||
// Compat with older Fresh versions
|
||||
export {
|
||||
type AppProps,
|
||||
defineApp,
|
||||
defineLayout,
|
||||
defineRoute,
|
||||
type ErrorPageProps,
|
||||
type Handlers,
|
||||
type Handlers as Handler,
|
||||
type LayoutProps,
|
||||
type RouteContext,
|
||||
type UnknownPageProps,
|
||||
} from "./compat/server.ts";
|
||||
|
||||
Reference in New Issue
Block a user