Typescript and large Root store - The inferred type of this node exceeds the maximum length the compiler will serialize. #2115
Answered
by
sergioisidoro
sergioisidoro
asked this question in
Q&A
|
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?) |
Answered by
sergioisidoro
Nov 12, 2023
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:
|
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
withSetPropaction 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…