Problem
Registering @vllnt/convex-api-keys as a Convex component adds deeply nested types to the host app's generated api.d.ts. This pushes TypeScript past its recursion limit (TS2589) in files that:
- Use
action() / query() / mutation() from _generated/server
- Use
v.union() with 6+ literals
- Use
createTracedFunctions() or any wrapper that resolves through the full DataModel
Reproduction
// convex.config.ts
import apiKeys from "@vllnt/convex-api-keys/convex.config";
app.use(apiKeys);
// any file using action() from _generated/server
export const myAction = action({ // TS2589: Type instantiation is excessively deep
args: { type: v.union(v.literal("a"), v.literal("b"), v.literal("c")) },
...
});
Workarounds currently needed
actionGeneric from convex/server instead of action from _generated/server
*Generic builders (queryGeneric, internalQueryGeneric, etc.) in traced function wrappers
const internal: any = _internal to break the type chain on ctx.runQuery(internal....) calls
--max-old-space-size=8192 for web typecheck (OOM from transitive type resolution)
Expected
Registering the component should not increase type depth enough to trigger TS2589 in the host app. Other @convex-dev/* components (workflow, rate-limiter, presence, workpool, crons) don't cause this.
Likely cause
The component's schema or generated types export deeply nested generic types. The sub-components (@convex-dev/aggregate, @convex-dev/sharded-counter, @convex-dev/rate-limiter, @convex-dev/crons) each add type depth, and stacking 4 of them compounds the nesting.
Environment
@vllnt/convex-api-keys: 0.1.1-canary.f11443e
convex: 1.31.2
- TypeScript: 5.9.3
Problem
Registering
@vllnt/convex-api-keysas a Convex component adds deeply nested types to the host app's generatedapi.d.ts. This pushes TypeScript past its recursion limit (TS2589) in files that:action()/query()/mutation()from_generated/serverv.union()with 6+ literalscreateTracedFunctions()or any wrapper that resolves through the fullDataModelReproduction
Workarounds currently needed
actionGenericfromconvex/serverinstead ofactionfrom_generated/server*Genericbuilders (queryGeneric,internalQueryGeneric, etc.) in traced function wrappersconst internal: any = _internalto break the type chain onctx.runQuery(internal....)calls--max-old-space-size=8192for web typecheck (OOM from transitive type resolution)Expected
Registering the component should not increase type depth enough to trigger TS2589 in the host app. Other
@convex-dev/*components (workflow, rate-limiter, presence, workpool, crons) don't cause this.Likely cause
The component's schema or generated types export deeply nested generic types. The sub-components (
@convex-dev/aggregate,@convex-dev/sharded-counter,@convex-dev/rate-limiter,@convex-dev/crons) each add type depth, and stacking 4 of them compounds the nesting.Environment
@vllnt/convex-api-keys: 0.1.1-canary.f11443econvex: 1.31.2