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

Configure Feed

Select the types of activity you want to include in your feed.

fix(graphqlsp): Fix unexpected `undefined` when checking persisted call (#337)

authored by

Phil Pluckthun and committed by
GitHub
3dc8fde4 4e20d3e9

+9 -2
+5
.changeset/silent-falcons-explode.md
··· 1 + --- 2 + '@0no-co/graphqlsp': patch 3 + --- 4 + 5 + Fix unexpected case of persisted calls resolving to `undefined` AST nodes.
+4 -2
packages/graphqlsp/src/ast/checks.ts
··· 51 51 52 52 /** Checks if node is a gql.tada graphql.persisted() call */ 53 53 export const isTadaPersistedCall = ( 54 - node: ts.Node, 54 + node: ts.Node | undefined, 55 55 checker: ts.TypeChecker | undefined 56 56 ): node is ts.CallExpression => { 57 - if (!ts.isCallExpression(node)) { 57 + if (!node) { 58 + return false; 59 + } else if (!ts.isCallExpression(node)) { 58 60 return false; 59 61 } else if (!ts.isPropertyAccessExpression(node.expression)) { 60 62 return false; // rejecting non property access calls: <expression>.<name>()