graphql-editor / graphql-zeus

GraphQL client and GraphQL code generator with GraphQL autocomplete library generation ⚡⚡⚡ for browser,nodejs and react native ( apollo compatible )
https://graphqleditor.com/docs/tools/zeus/index/
MIT License
1.94k stars 105 forks source link

Inferred type exceeds the maximum length the compiler will serialize #382

Closed donferi closed 5 months ago

donferi commented 1 year ago

Hello,

I'm trying to create a couple of wrapper functions where I accept a generic of TData extends ValueTypes['Query'] but when I use this with a declaration: true in tsconfig I get TS error.

The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.

I'm working on a library so I can't disable declaration: true. I created a small repro that reproduces this here: https://github.com/donferi/zeus-ts/blob/690211ccfad13e492b0d0ee3186ace1841d476de/src/example.ts#L10:L13

In that same repo I have an example with genql and it seems to be working fine, added it just in case it sparks some ideas of how this could potentially work.

rtmruczek commented 5 months ago

I had the same issue. I ended up swapping out zeus for genql and had no issues

aexol commented 5 months ago

This is not zeus issue, but TS limitation - it happens when you reexport packages inside custom package. This however has been fixed in the latest version, by allowing to set up custom scalars one level up inside Thunder function