dotansimha / dotansimha/graphql-code-generator-community
Typed-Document-Node with Apollo-Angular
- Dominant language
- TypeScript
- Stars
- 137
- Forks
- 195
- Avg merge
- 6h 20m
- Merged PRs (30d)
- 16
Description
We are currently using typescript-apollo-angular to generate our type hints.
We now want to make use of `typed-document-node` in conjunction with `ts-apollo-angular` to benefit from the additional ergonomics of `typed-document-node` during cache interactions.
We have tried the following configuration, but the typed document node lacks all of the generic type annotations:
```ts
documents: [
"apps/**/src/app/**/*.graphql",
"libs/**/*.graphql"
],
generates: {
["./"]: {
preset: "near-operation-file",
presetConfig: {
baseTypesPath: "our-base-types-module",
importTypesNamespace: "GraphQlTypes"
},
config: {
documentNodeImport: "@graphql-typed-document-node/core#TypedDocumentNode",
documentMode: "documentNode"
},
plugins: [
"typescript-operations",
"typescript-apollo-angular"
]
}
},
```
### Describe the solution you'd like
Have either an additional option for the apollo angular plugin to use the typed document node directly, or make it compatible in a better way
### Describe alternatives you've considered
The alternative is duplicating the type definitions. (One for apollo-angular, one for typed-document-node). This is not an option as it unnecessarily increases bundle size and creates type redundancies, decreasing code ergonomics.
Typed-Document-Node just by itself as a replacement for the apollo-angular plugin is also not an alternative due to the handy inject syntax that goes well with apollo-angular.
### Is your feature request related to a problem? Please describe.
See above, it currently does not work.
This issue continues the discussion from https://github.com/dotansimha/graphql-code-generator/issues/9500#issuecomment-2645772300
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.