Skip to content

Commit

Permalink
fix: Export introspection type in d.ts output (#184)
Browse files Browse the repository at this point in the history
* Update d.ts output to export introspection type

* Add changeset

* Fix typo (whoops)
  • Loading branch information
kitten authored Jan 18, 2024
1 parent 1dc48cf commit 828de89
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/hot-icons-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@0no-co/graphqlsp': patch
---

When creating a `d.ts` file, export the introspection type to make it reusable.
4 changes: 2 additions & 2 deletions packages/graphqlsp/src/graphql/getSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ async function saveTadaIntrospection(
if (/\.d\.ts$/.test(output)) {
contents = [
dtsAnnotationComment,
`declare const introspection: ${json};\n`,
`export type introspection = ${json};\n`,
"import * as gqlTada from 'gql.tada';\n",
"declare module 'gql.tada' {",
' interface setupSchema {',
' introspection: typeof introspection',
' introspection: introspection',
' }',
'}',
].join('\n');
Expand Down

0 comments on commit 828de89

Please sign in to comment.