-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.1.1 breaks type inference #130
Comments
Yep confirmed. I am experiencing the same issue. My current setup: @graphql-typed-document-node/core: 3.1.0 When I upgrade to @graphql-typed-document-node/core to 3.1.1, then I lose all the types on |
Same for me when using the latest versions of all the packages. |
Glad I found this thread, I confirm @graphql-typed-document-node/core: 3.1.1 is breaking the inference, 3.1.0 is good. |
Same here |
Seem to be experiencing this as well |
Hi So far, a "simple setup" with the latest versions of I also tried to reproduce it without dependencies (with pure types) as follows, without success. if any of you can share a Github/Codesandbox/Stackblitz that reproduces the issue (using the latest versions), it would be very helpful! 🙇🏼 |
@charlypoly I recently updated No issues with the newer versions of both. Thanks 👍🏻 |
Works here, too. 👍 |
@adnan-sheikh @lensbart Thank you for your feedback! |
@charlypoly Can we close this? |
Yes! cc @dotansimha |
resolution I was experiencing the same issue where types were not inferred (see full details below). The problem turned out to be a subtlety in typescript module resolution. My relevant tsconfig bits and folder structure: "baseUrl": ".",
"moduleResolution": "node",
Two potentials solutions:
I went with (2) because I didn't want to rename all of the imports currently referencing Original post Something potentially interesting to add... I have a monorepo with two packages that are displaying different behavior. One properly infers the Data type and the other does not. They do have different tsconfigs, but i've so far been unable to track down a config option that explains the difference in behavior. One insight from the package in which inference does not work:
That seems like an odd error to me considering TypedDocumentNode extends DocumentNode. EDIT: Digging a bit deeper:
In the correct one, DocumentNode is a valid type exported by graphql. In the incorrect one, typescript doesn't think DocumentNode is exported.
When I "go-to-definition" they both lead to the same file on disk in node_modules/graphql/language/ast. |
After I upgraded from 3.1.0 to 3.1.1 I got a lot of type errors in my project.
My setup:
Query:
Generated document:
Component:
With v3.1.0
After upgrade to v3.1.1
This seems to be caused by the removal of
__resultType
and__variablesType
in 6ee77c2#diff-9a4ceebe7c6f86856371906c3f061d3b56b7457022b05179884a113e7ced67e8If I add the properties back using interface augmentation, it works again:
The text was updated successfully, but these errors were encountered: