qian321
qian3212mo ago

Can't find a way to address error: Type instantiation is excessively deep and possibly infinite.

I've tried all suggestions discussed already in discord but none seems to work for me, add return types, comment out all my logic, change ts target to ESNext, etc. everything. I'm still facing this error when using the api calls. One workaround I found is I can do something like:
import { api as convexApi } from "@stilltime/backend/api";
...
// Type utility to simplify deep types
type Simplify<T> = { [K in keyof T]: T[K] } & {};

// Create a simplified version of the API to avoid deep type instantiation
// @ts-ignore TS2589: Type instantiation is excessively deep and possibly infinite
const api = convexApi as Simplify<typeof convexApi>;
import { api as convexApi } from "@stilltime/backend/api";
...
// Type utility to simplify deep types
type Simplify<T> = { [K in keyof T]: T[K] } & {};

// Create a simplified version of the API to avoid deep type instantiation
// @ts-ignore TS2589: Type instantiation is excessively deep and possibly infinite
const api = convexApi as Simplify<typeof convexApi>;
and then just use this wrapped api instead. This way I persist type check while only need to add one ts-ignore. My question is, is this an okay solution? will there be other gotchas?
2 Replies
Convex Bot
Convex Bot2mo ago
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!
Vindex
Vindex2d ago
did you find any solution to this? currently facing the same issue, I tried what is in the docs but nothing seems to fix it

Did you find this page helpful?