diff --git a/.changeset/metal-seals-swim.md b/.changeset/metal-seals-swim.md new file mode 100644 index 00000000..bb5d92dd --- /dev/null +++ b/.changeset/metal-seals-swim.md @@ -0,0 +1,5 @@ +--- +"@0no-co/graphqlsp": patch +--- + +Fix wrong fileType diagnostic error when introspection is disabled diff --git a/packages/graphqlsp/src/graphql/getSchema.ts b/packages/graphqlsp/src/graphql/getSchema.ts index ba9d89c5..a45007b4 100644 --- a/packages/graphqlsp/src/graphql/getSchema.ts +++ b/packages/graphqlsp/src/graphql/getSchema.ts @@ -126,12 +126,14 @@ export const loadSchema = ( } if (ref.current) { - saveTadaIntrospection( - ref.current.introspection, - tadaOutputLocation, - tadaDisablePreprocessing, - logger - ); + if (ref.current && ref.current.tadaOutputLocation !== undefined) { + saveTadaIntrospection( + ref.current.introspection, + tadaOutputLocation, + tadaDisablePreprocessing, + logger + ); + } } else if (ref.multi) { Object.values(ref.multi).forEach(value => { if (!value) return;