seamoss
seamoss•3w ago

The Recursive Drug Lab

Good call out, wouldn't think to update. Tried that and typescript is still upset at me for the type recursion depth. I think it's because my convex folder structure is deeply nested and that might not be an ideal organization structure for convex with how it generated the api schema.
2 Replies
deen
deen•3w ago
i'm not sure if nested itself would make a big difference. the common cause is use ctx.run* on functions in the same file. it's annoying but you can try splitting them up. i was wondering if you had many many validator types or if your ECS pattern meant you were using a lot of untyped fields. but it looks like there's potentially a lot of other stuff going on too. another thing you could try is the new tsgo compiler. i still haven't tried it myself but i imagine it can't be hard to set up. if that fails then you truly have a genuine infinite loop happening that you would have to isolate somehow
seamoss
seamossOP•3w ago
I'm using a lot of type trickery to get convex to work with the ECS pattern. Every component has a table and I store all the component tables in an object then infer return types through any table that's a union of both a convex table schema and my massive component list. It's not.. the best way to do things probably, but premature optimization has always been the thing that kills me. So, been putting off making this whole thing more sensible. My update component function basically takes in a v.any() for the data field then does the check inside the function. Though this error didn't come up until I started adding actions. Convex really wants strong typing on everything where possible, and I get that. But it's difficult to avoid any every once in a while when trying to do data composition through convex tables like this. 🫠 Good ideas though! I wouldn't think to check the ctx.run in multiple files

Did you find this page helpful?