Skip to content

Commit

Permalink
non optional typenames (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Jun 9, 2023
1 parent 0212262 commit 7bf3ec7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/light-moose-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@0no-co/graphqlsp': patch
---

Add `nonOptionalTypename: true` as this allows for easier type matching
4 changes: 3 additions & 1 deletion packages/graphqlsp/src/graphql/generateTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const generateBaseTypes = async (
avoidOptionals: false,
enumsAsTypes: true,
globalNamespace: true,
nonOptionalTypename: true,
},
filename: outputFile,
schema: parse(printSchema(schema)),
Expand Down Expand Up @@ -79,10 +80,11 @@ export const generateTypedDocumentNodes = async (
},
],
config: {
namespacedImportName: 'Types',
scalars,
avoidOptionals: false,
enumsAsTypes: true,
nonOptionalTypename: true,
namespacedImportName: 'Types',
},
filename: outputFile,
schema: parse(printSchema(schema)),
Expand Down

0 comments on commit 7bf3ec7

Please sign in to comment.