Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit e504bb4

Browse files
committed
Update global types
1 parent af0730c commit e504bb4

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

server/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export interface HTMLRewriter {
135135
on: (selector: string, handlers: HTMLRewriterHandlers) => void;
136136
}
137137

138-
export type Context<T extends Record<string, unknown> = Record<string, unknown>> = T & {
138+
export interface Context extends Record<string, unknown> {
139139
/** The request connection info. */
140140
readonly connInfo?: ConnInfo;
141141
/** The params of dynamic routes. */
@@ -148,7 +148,7 @@ export type Context<T extends Record<string, unknown> = Record<string, unknown>>
148148
getSession: <T extends Record<string, unknown> = Record<string, unknown>>() => Promise<Session<T>>;
149149
/** Returns the next `Response` object. */
150150
next: () => Promise<Response> | Response;
151-
};
151+
}
152152

153153
/** The Middleare for Aleph server. */
154154
export interface Middleware {

types.d.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
declare type Context<T extends Record<string, unknown> = Record<string, unknown>> = import("./server/types.ts").Context<
2-
T
3-
>;
4-
declare type Middleware = import("./server/types.ts").Middleware;
1+
type CTX = import("./server/types.ts").Context;
2+
// deno-lint-ignore no-empty-interface
3+
declare interface Context extends CTX {}
4+
5+
/** The Middleare for Aleph server. */
6+
declare interface Middleware {
7+
/** The middleware name. */
8+
readonly name?: string;
9+
/** The middleware fetch method. */
10+
fetch(request: Request, context: Context): Promise<Response> | Response;
11+
}
512

613
declare interface ImportMeta {
714
/** Aleph.js HMR `hot` API. */

0 commit comments

Comments
 (0)