Large codebase: internal type only shows one module

Apologies for the AI summary of the issue, but I've been banging my head on this all day. Could really use some help!

Problem: TypeScript says
internal.todoist
doesn't exist, but it's in the generated
api.d.ts
.

Environment: ~200 Convex functions, TypeScript strict mode, Bun runtime

Error:
Property 'todoist' does not exist on type '{ routines: {...} }'.


The Weird Part:
-
api.d.ts
includes all todoist functions in
fullApi
(70+ functions)
-
internal
is defined as
FilterApi<typeof fullApi, FunctionReference<any, "internal">>

- But TS resolves
internal
to only show
routines
module, not
todoist


One file shows:
error TS2589: Type instantiation is excessively deep and possibly infinite


Structure:
convex/
├── routines/ (~22 files - internalActions, internalMutations, internalQueries, queries)
└── todoist/ (~80 files - actions, internalMutations, internalQueries, queries, computed/)


Tried:
- Cleared TS cache, regenerated with
--typecheck=disable

- Fixed directory permissions
- Verified individual files compile fine
- Confirmed all functions use correct decorators (
internalMutation
,
internalQuery
)

Questions:
1. Is there a limit to functions in
FilterApi
?
2. Could the "type instantiation depth" error be causing partial type resolution?
3. Best practices for large Convex projects?

Currently using
@ts-expect-error
everywhere which defeats type safety. Any ideas?
Was this page helpful?