Type instantiation is excessively deep and possibly infinite.
I’m encountering the following TypeScript error in my project:
Type instantiation is excessively deep and possibly infinite
I’m new to TypeScript and don’t have much experience with its type system. My project has a complex directory structure with multiple levels of nesting, and I suspect the deeply nested structure might be causing the issue.
Here is how directory structure roughly looks like:
Are there general best practices for handling query and mutation definitions in a project with this kind of nested structure?2 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
Your directory structure looks fine, this is usually due to some function running
ctx.runQuery/Mutation/Action
and then returning a value received from that query/mutation/action that was triggered. There's info in the docs for this here: https://docs.convex.dev/functions/actions#dealing-with-circular-type-inferenceActions | Convex Developer Hub
Actions can call third party services to do things such as processing a payment