Skip to content

Commit

Permalink
Fix __typename inclusion in GraphQL types
Browse files Browse the repository at this point in the history
  • Loading branch information
lemonmade committed Aug 5, 2024
1 parent ba74966 commit f775fdf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/three-bats-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@quilted/graphql-tools': patch
---

Fix `__typename` inclusion in GraphQL types
4 changes: 2 additions & 2 deletions packages/graphql-tools/source/typescript/print/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ function exportsForSelection(
const interfaceBody: TSTypeElement[] = [];
const namespaceBody: Statement[] = [];

const {addTypename = true} = context.kind;
const {addTypename = false} = context.kind;

if (type !== context.rootType && addTypename) {
const typenameField = t.tsPropertySignature(
Expand Down Expand Up @@ -600,7 +600,7 @@ function createDocumentExportValue(
document: DocumentNode,
outputKind: DocumentOutputKind,
) {
const {addTypename: shouldAddTypename = true} = outputKind;
const {addTypename: shouldAddTypename = false} = outputKind;

const minifiedDocument = minify(
shouldAddTypename ? addTypename(document, {clone: true}) : document,
Expand Down

0 comments on commit f775fdf

Please sign in to comment.