Files
OmniRoute/src/middleware
backryun 6601ae3a8d fix(middleware): declare withInjectionGuard's context parameter optional (#8644)
All five diagnostics in src/lib/batches/dispatch.ts are the same:

  Type '(request: any, context: any) => Promise<any>' is not assignable to
  type 'BatchRouteHandler'.
    Target signature provides too few arguments. Expected 2 or more, but got 1.

`withInjectionGuard()` returns `guardedHandler(request, context: any)` with the
second parameter required, so every route it wraps advertises arity 2. The batch
dispatcher's `BatchRouteHandler` is `(request: Request) => …`, and TS rejects
assigning a function that needs an argument the caller will never supply.

The declaration was wrong about its own runtime. `dispatch.ts:48` already calls
`handler(request)` with one argument, and has been doing so in production;
`context` is only forwarded to the inner handler, where routes that do not read
it get `undefined`. Marking it `context?: any` states what was already true.

208 -> 203, zero new, on a line-number-agnostic diff of the full tsc error set.
One character; nothing executable changed.

No test added: the one-argument call path is the existing behaviour and is
already covered — embeddings-auth.test.ts and embeddings-route-apikeymeta-6929
call `POST(req)` directly through withInjectionGuard, which is exactly the arity
this now permits. 370/370 across the 43 injection-guard / batch / embeddings /
moderation suites; typecheck:core, eslint and check:file-size clean.

Co-authored-by: backryun <busan011@ormbiz.co.kr>
2026-07-27 19:08:15 -03:00
..