The type of a composed stack handed to the host — the fetch export,
Deno.serve(app), and so on.
Annotating the outermost handler with this (… satisfies FetchHandler) is
optional and adds no runtime code. It does two things:
Asserts the stack can be the fetch export. Prerequisites are enforced
between layers with no annotation. What is left over is the case where no
layer supplies a declared In key: the requirement is republished all the
way out, so the stack has a requiredctx. That alone is not an error —
a required ctx is only wrong where the stack is handed to the host, and
this type is what makes that position explicit (its ctx is optional, and a
required one is not assignable to it). An untyped
export default { fetch: app } checks nothing, so without the annotation
the stack compiles, ships, and reads undefined off ctx on the first
request. Any FetchHandler-typed position does the same job.
Turns on collision detection. Two middleware contributing the same key
are only caught under this annotation; see the Middleware overload set.
One annotation on the outermost call covers any nesting depth.
It is not needed for accumulation: an unannotated outermost call resolves
Base to its constraint — the empty upstream, the same context an annotation
would seed — so the cascade reaches the innermost handler at any depth either
way. Nor for In prerequisites (those travel outward), nor for
pipeline (which accumulates and validates from its entries array).
The type of a composed stack handed to the host — the
fetchexport,Deno.serve(app), and so on.Annotating the outermost handler with this (
… satisfies FetchHandler) is optional and adds no runtime code. It does two things:fetchexport. Prerequisites are enforced between layers with no annotation. What is left over is the case where no layer supplies a declaredInkey: the requirement is republished all the way out, so the stack has a requiredctx. That alone is not an error — a requiredctxis only wrong where the stack is handed to the host, and this type is what makes that position explicit (itsctxis optional, and a required one is not assignable to it). An untypedexport default { fetch: app }checks nothing, so without the annotation the stack compiles, ships, and readsundefinedoffctxon the first request. AnyFetchHandler-typed position does the same job.Middlewareoverload set. One annotation on the outermost call covers any nesting depth.It is not needed for accumulation: an unannotated outermost call resolves
Baseto its constraint — the empty upstream, the same context an annotation would seed — so the cascade reaches the innermost handler at any depth either way. Nor forInprerequisites (those travel outward), nor for pipeline (which accumulates and validates from its entries array).