Typescript and large Root store - The inferred type of this node exceeds the maximum length the compiler will serialize. #2115
-
I'm hitting a problem as my stores and models keep getting bigger.
I have checked and I can't find any recursive declaration that could result in this. I'm actually hitting the limit just by adding some additional simple field declarations (the error goes away if I comment it) Wondering if anyone has came across this problem, and how did you solve it? And also, how did you debug it (how did you see if there's any leaky declaration of the type?) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hey @sergioisidoro - I've never seen this before. Sounds really frustrating, but also kind of neat (in an annoying way). What I do know is that our existing TypeScript types are somewhat verbose, so this doesn't shock me. Is there any chance you can share:
|
Beta Was this translation helpful? Give feedback.
No problem :)
My expectations about opening this thread was to allow others to find this problem if they were struggling.
In my case I managed to delay the problem by removing the
withSetProp
action from the models that don't use it, which pruned the type declarations enough for the typescript compiler to stop complaining.If this ever becomes a problem again, I'll probably have to tweak those utilities and maybe pass the type annotations some other way to those generic actions (for example, by explicitly passing they keys of which setters I want to generate, and what are their types).
Thanks for taking the time to answer this. If I find some better solution in the future I'll post it her…