Skip to main content
Module

x/shed/index.ts>ContextOf

All Worker Tools under a single roof
Latest
type alias ContextOf
import { type ContextOf } from "https://deno.land/x/shed@v0.1.0-pre.10/index.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>>