The collision check Middleware applies: resolves to Handler when
Key is free on Base, and to a Conflict sentinel when it is not.
Site it on the handler parameter, not the Base constraint. TypeScript
substitutes a failed constraint silently but prints a failed parameter
verbatim, so on the parameter the sentinel's text reaches the reader and the
error is reported on the offending call rather than the one enclosing it.
pipeline has always taken this route (see ValidateEntries); the
Middleware overloads are the nesting equivalent.
Reuse it in a middleware with a bespoke generic signature (e.g. one that adds
a Payload type parameter) by wrapping the handler parameter and leaving the
Base constraint to In & BaseContext:
Every overload that can accept the handler needs the wrap. One left unguarded
will accept the call the guarded one rejected, resolve its own Base to
something unusable, and push the error back out to the enclosing call — which
is the failure mode this type exists to remove.
The collision check Middleware applies: resolves to
HandlerwhenKeyis free onBase, and to a Conflict sentinel when it is not.Site it on the handler parameter, not the
Baseconstraint. TypeScript substitutes a failed constraint silently but prints a failed parameter verbatim, so on the parameter the sentinel's text reaches the reader and the error is reported on the offending call rather than the one enclosing it. pipeline has always taken this route (seeValidateEntries); the Middleware overloads are the nesting equivalent.Reuse it in a middleware with a bespoke generic signature (e.g. one that adds a
Payloadtype parameter) by wrapping the handler parameter and leaving theBaseconstraint toIn & BaseContext:Every overload that can accept the handler needs the wrap. One left unguarded will accept the call the guarded one rejected, resolve its own
Baseto something unusable, and push the error back out to the enclosing call — which is the failure mode this type exists to remove.