Skip to content

docs(vanilla typescript): Fix the return type of the exec function #10360

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

Merged
merged 5 commits into from
Jun 24, 2025

Conversation

Brookke
Copy link
Contributor

@Brookke Brookke commented May 28, 2025

Description

When working through the vanilla typescript example I found that the shape of the data actually returned by the fetch was result.data.allPeople rather than result.allPeople that the types suggests. This PR corrects that.

Related #10359

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Screenshots/Sandbox (if appropriate/relevant):

N/A

How Has This Been Tested?

N/A - though confirmed this change works by others #10359 (comment)

Checklist:

  • I have followed the CONTRIBUTING doc and the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

When working through the vanilla typescript example I found that the shape of the data actually returned by the fetch was `result.data.
Copy link

changeset-bot bot commented May 28, 2025

⚠️ No Changeset found

Latest commit: 35dc815

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -181,6 +181,7 @@ We can build a simple wrapper around `fetch` that takes a `TypedDocumentString`
returns a typed response.

```typescript filename="src/graphql/execute.ts"
import { ExecutionResult } from 'graphql'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think most readers would be on the later versions of TypeScript which allows import type. I think this is better in general 🙂

Suggested change
import { ExecutionResult } from 'graphql'
import type { ExecutionResult } from 'graphql'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I will adjust

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted @eddeee888

Copy link
Collaborator

@eddeee888 eddeee888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!
I've verified this suggestion locally and it works 🎉

@eddeee888 eddeee888 merged commit 8394c8b into dotansimha:master Jun 24, 2025
19 checks passed
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