Skip to main content
Module

x/workers_middleware/context.ts>ContextOf

Placeholder for Worker-based middleware solution
Latest
type alias ContextOf
import { type ContextOf } from "https://deno.land/x/workers_middleware@v0.1.0-pre.36/context.ts";

Helper type to get the context type of a given middleware function.

Example:

const mw = combine(basics(), contentTypes(['text/html', 'application/json']))
type MWContext = ContextOf<typeof mw>;
const handler = (req: Request, context: MWContext) => ok()
new WorkerRouter().get('/', mw, handler)

Type Parameters

MW extends (...args: any[]) => Awaitable<Context>
definition: Awaited<ReturnType<MW>>