graphql-code-generator
graphql-code-generator copied to clipboard
Using `inlineFragmentTypes: 'combine'` and `mergeFragmentTypes: true` generates invalid imports/markup
Which packages are impacted by your issue?
@graphql-codegen/typescript-operations
Describe the bug
When using inlineFragmentTypes: 'combine' and mergeFragmentTypes: true together, if I create a fragment on an interface and then use it, the types that are generated are invalid.
It's trying to reference the types that are generated without mergeFragmentTypes i.e. UserDetails_UserWithEmail_Fragment when they have been merged into UserDetailsFragment so it's now invalid
Your Example Website or App
https://codesandbox.io/p/devbox/inline-fragment-types-issue-2wlt75
Steps to Reproduce the Bug or Issue
- Create a fragment on an interface
- Use it in two different queries for two different types
- Run codegen with
inlineFragmentTypes: 'combine'andmergeFragmentTypes: true
Expected behavior
I would expect the generated types to reference the merged fragment types i.e. UserDetailsFragment not UserDetails_UserWithEmail_Fragment
Screenshots or Videos
No response
Platform
- OS: macOS
- NodeJS: 22.13.0
-
graphqlversion: 16.10.0 -
@graphql-codegen/*version(s):- "@graphql-codegen/typescript": "4.1.3",
- "@graphql-codegen/typescript-operations": "4.4.1",
Codegen Config File
No response
Additional context
No response