Nested fragments based on interface generate too many typescript types - out of memory compilator issue #5270
Unanswered
Marcinthedev
asked this question in
General
Replies: 1 comment
-
Thank you for reporting this @Marcinthedev . Can you please share a live reproduction of that issue? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have a problem with nested types. Codegen generates huge file of types while nesting fragments. It's that big that compilator has problems with them and runs out of memory.
I have in schema lots of possible types which implement one interface. I am using this interface in __resolveTypes to get the correct type of data. On the client side I've created matching fragments and I have a use case that they may be nested. Here is an example:
where
BasicField
isand all of the others are types that implement this interface.
The issue here is that I want to return BasicField which may be any of them. When it's GroupField it may have nested elements thus I need to return something like this:
My case is more complex but the solution is the same. Just more nested elements and more properties.
Is there a way to may shorten typescript somehow? It also generates DateField with the
fieldsGroup
property while it will never have such data.If something is unclear I will try to create a better and complex example
Beta Was this translation helpful? Give feedback.
All reactions