Mirror: TypeScript LSP plugin that finds GraphQL documents in your code and provides diagnostics, auto-complete and hover-information.

fix(lsp): undefined typeArguments (#297)

Changed files
+9 -1
.changeset
packages
graphqlsp
+5
.changeset/blue-ghosts-sell.md
···
+
---
+
'@0no-co/graphqlsp': patch
+
---
+
+
Fix crash due to typeArguments being undefined
+4 -1
packages/graphqlsp/src/fieldUsage.ts
···
if ('target' in type) {
const typeArguments = (type as any)
.resolvedTypeArguments as readonly ts.Type[];
-
dataType = typeArguments.length > 1 ? typeArguments[0] : undefined;
+
dataType =
+
typeArguments && typeArguments.length > 1
+
? typeArguments[0]
+
: undefined;
}
// Fallback to resolving the type from scratch
if (!dataType) {