Problem
tRPC routers that import procedures from separate files are not detected. This pattern is common in larger tRPC codebases, where each procedure lives in its own file.
// src/router.ts
import { router } from "./trpc";
import { getUsers } from "./procedures/getUsers";
import { createUser } from "./procedures/createUser";
export const appRouter = router({
getUsers, // ShorthandPropertyAssignment — not detected
createUser, // ShorthandPropertyAssignment — not detected
inline: publicProcedure.query(async () => "ok"), // detected ✓
});
Issues
- Only inline procedure chains (
.query(), .mutation()) are detected.
- Imported procedures using shorthand syntax produce zero routes.
- Most real-world tRPC projects end up with incomplete route coverage.
- Detected tRPC procedures are incorrectly grouped under "GraphQL" due to shared method names (
QUERY, MUTATION, SUBSCRIPTION), which is misleading.
Proposed Changes
1. AST Enhancements: Support Missing tRPC Patterns
Add handling for the following patterns:
2. Treat tRPC as a First-Class Concept
-
Filter routes using:
instead of relying on method names.
-
Render a dedicated section:
-
Standardize all detected procedures to:
-
Do not attempt to resolve query vs mutation:
- Requires fragile import resolution
- Provides minimal value in this context
- The distinction can be determined when inspecting the source file
3. Deduplicate tRPC Routes
Problem
tRPC routers that import procedures from separate files are not detected. This pattern is common in larger tRPC codebases, where each procedure lives in its own file.
Issues
.query(),.mutation()) are detected.QUERY,MUTATION,SUBSCRIPTION), which is misleading.Proposed Changes
1. AST Enhancements: Support Missing tRPC Patterns
Add handling for the following patterns:
Shorthand Property Assignment
Identifier Initializer
Nested Namespace Objects
2. Treat tRPC as a First-Class Concept
Filter routes using:
instead of relying on method names.
Render a dedicated section:
Standardize all detected procedures to:
Do not attempt to resolve
queryvsmutation:3. Deduplicate tRPC Routes
When both AST and regex fallback detect the same procedure: