TypedDocumentNode and typescript-apollo-angular #1676
-
2.6.0 is released and with it TypedDocumentNode compatibility. But how am i supposed to use it ? I naively install this packages : {
"@graphql-codegen/cli": "^1.21.5",
"@graphql-codegen/typed-document-node": "^1.18.6",
"@graphql-codegen/typescript": "^1.22.1",
"@graphql-codegen/typescript-apollo-angular": "^2.3.1",
"@graphql-codegen/typescript-operations": "^1.18.0",
"@graphql-typed-document-node/core": "^3.1.0",
} With this overwrite: true
schema: "http://localhost:4000"
documents: "src/**/*.graphql"
generates:
src/app/core/graphql.ts:
plugins:
- "typescript"
- "typescript-operations"
# - "typescript-apollo-angular"
- "typed-document-node" Note that I have commented typescript-apollo-angular because of generation conflict. And, naturaly, it doesn't generate all query/mutation/subscription services. So before I start migrating my code from using query/mutation/subscription services to basic apollo service use, am I doing something wrong ? Is there a way to generate services that will use TypedDocumentNode ? Are services useless now that query are automatically typed ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
Hi! |
Beta Was this translation helpful? Give feedback.
Hi!
You can't use both since they will conflict. You should use only
typed-document-node
.Then, when you use the generate
...Document
variable with your Apollo-Angular instance, it will be typed automatically. No need fortypescript-apollo-angular
.