Skip to content
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

Merged
merged 3 commits into from
Apr 12, 2024

Conversation

JoviDeCroock
Copy link
Member

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 and ts.typeQuery to the document.

Copy link

changeset-bot bot commented Apr 12, 2024

🦋 Changeset detected

Latest commit: 45d481a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@0no-co/graphqlsp Minor

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

.changeset/cuddly-needles-glow.md Outdated Show resolved Hide resolved
Comment on lines +184 to +197
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,
};
}
Copy link
Member

@kitten kitten Apr 12, 2024

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?

Copy link
Member Author

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?

Copy link
Member

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 🤔

@JoviDeCroock JoviDeCroock merged commit 4ddb436 into main Apr 12, 2024
1 check passed
@JoviDeCroock JoviDeCroock deleted the adjust-persisted-to-support-document-arg branch April 12, 2024 11:47
@github-actions github-actions bot mentioned this pull request Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants