···11+---
22+"@0no-co/graphqlsp": patch
33+---
44+55+Fix schema derivation when using `graphql.persisted`, we used the wrong expression in the ast
+7-2
packages/graphqlsp/src/ast/checks.ts
···9393/** Retrieves the `__name` branded tag from gql.tada `graphql()` or `graphql.persisted()` calls */
9494export const getSchemaName = (
9595 node: ts.CallExpression,
9696- typeChecker: ts.TypeChecker | undefined
9696+ typeChecker: ts.TypeChecker | undefined,
9797+ isTadaPersistedCall = false
9798): string | null => {
9899 if (!typeChecker) return null;
9999- const type = typeChecker.getTypeAtLocation(node.expression);
100100+ const type = typeChecker.getTypeAtLocation(
101101+ // When calling `graphql.persisted`, we need to access the `graphql` part of
102102+ // the expression; `node.expression` is the `.persisted` part
103103+ isTadaPersistedCall ? node.getChildAt(0).getChildAt(0) : node.expression
104104+ );
100105 if (type) {
101106 const brandTypeSymbol = type.getProperty('__name');
102107 if (brandTypeSymbol) {
+1-1
packages/graphqlsp/src/ast/index.ts
···215215 if (!checks.isTadaPersistedCall(node, typeChecker)) {
216216 return;
217217 } else if (info) {
218218- const name = checks.getSchemaName(node, typeChecker);
218218+ const name = checks.getSchemaName(node, typeChecker, true);
219219 result.push({ node, schema: name });
220220 } else {
221221 result.push(node);