fix(types): Using Express native QUERY method support#3519
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@express-zod-api/src/method.ts`:
- Around line 5-8: The router method union is missing "query", so the
Array<FamiliarMethod> check in FamiliarMethod is rejecting the methods list and
Method no longer includes that value. Update the type definition in method.ts to
explicitly include "query" alongside the existing excluded router members, or
otherwise restore the workaround so the methods array still satisfies the union
and Method retains "query".
In `@express-zod-api/src/routing.ts`:
- Line 84: The dynamic route registration in routing.ts now silently skips
unsupported methods because `app[method]?.(path, ...handlers)` no-ops when
`app[method]` is missing. Update the route setup logic around
`register`/`app[method]` to explicitly validate that the method exists before
invoking it, and surface a clear error or log when it does not. Keep the failure
behavior consistent with the previous `register(...).call(app, ...)` approach so
unsupported methods are not swallowed silently.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: fa0098d4-2071-4e45-9828-0edadcada821
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
express-zod-api/src/method.tsexpress-zod-api/src/routing.tspnpm-workspace.yaml
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — removal of the Express QUERY method workaround now that @types/express-serve-static-core@5.1.2 ships the type natively.
express-zod-api/src/method.ts— simplifiesFamiliarMethodto derive directly fromkeyof IRouter, dropping the manual"query"union and its@todo.express-zod-api/src/routing.ts— replaces the type-assertedregister.call(app, ...)shim withapp[method]?.(path, ...handlers).pnpm-lock.yaml— upgrades@types/express-serve-static-corefrom5.1.1to5.1.2.pnpm-workspace.yaml— adds a temporaryminimumReleaseAgeExcludefor the new types version with a removal date.
Verified with tsc --noEmit, the full express-zod-api test suite, and pnpm -F express-zod-api build; all pass.
Kimi K2 (free via Pullfrog for OSS) | 𝕏

I added QUERY to the Express types myself, so now I can remove the workaround.
Addresses the "todo" made in #3479
Summary by CodeRabbit