-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support first argument in graphql.persisted #287
Conversation
🦋 Changeset detectedLatest commit: 45d481a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
if ( | ||
!ts.isIdentifier(callExpression.arguments[1]) && | ||
!ts.isCallExpression(callExpression.arguments[1]) | ||
) { | ||
return { | ||
category: ts.DiagnosticCategory.Warning, | ||
code: MISSING_PERSISTED_TYPE_ARG, | ||
file: source, | ||
messageText: | ||
'Provided argument should be an identifier or invocation of "graphql" in the shape of graphql.persisted(hash, document).', | ||
start, | ||
length, | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a bit optimistic, so we may have to leave a todo here to check this later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realistically it can only be graphql.persisted(hash, document || graphql())
no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard to tell, I'm mostly afraid of indirection, e.g. re-exports with reassignments, etc, messing with later checks. So, just realised this doesn't really have much to do with the check here, but with the extraction in the other place 🤔
Co-authored-by: Phil Pluckthun <[email protected]>
We have a follow up planned where we leverage the typeChecker like https://github.com/0no-co/gql.tada/blob/main/packages/cli-utils/src/commands/cache.ts#L70-L91 to adjust the routing of
ts.identifier
andts.typeQuery
to the document.