diff --git a/.changeset/hot-icons-fetch.md b/.changeset/hot-icons-fetch.md new file mode 100644 index 00000000..93243265 --- /dev/null +++ b/.changeset/hot-icons-fetch.md @@ -0,0 +1,5 @@ +--- +'@0no-co/graphqlsp': patch +--- + +When creating a `d.ts` file, export the introspection type to make it reusable. diff --git a/packages/graphqlsp/src/graphql/getSchema.ts b/packages/graphqlsp/src/graphql/getSchema.ts index 1ba7a493..24062ea7 100644 --- a/packages/graphqlsp/src/graphql/getSchema.ts +++ b/packages/graphqlsp/src/graphql/getSchema.ts @@ -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');