Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

fix: unknown type in ExecutionResult #2832

Merged
merged 1 commit into from
Aug 30, 2024
Merged

Conversation

nattydodd
Copy link
Contributor

@nattydodd nattydodd commented Aug 30, 2024

Description

The Collective (merchant-to-merchant) team was trying to upgrade our graphql dependency to v16+ and were not able to due to failing typechecks.
The change in this PR from the @shopify/graphql-testing library was causing the typechecks to fail. The ExecutionResult type from graphql has a new definition is v16, which causes our fillGraphQL type to complain with this error:

Failure point Error message

Here is the difference between the types in the two versions which caused the types to complain.

graphql v15.8.0 graphql v16.9.0

To fix the issue, we had to pass in <{[key: string]: any}> as the generic type for ExecutionResult, inside the graphql-testing package

Tophatting

I tested this change in the merchant-to-merchant repo and we were able to successfully run our type-checks again. Thanks @BPScott for helping me out on this one 🙏

@nattydodd nattydodd self-assigned this Aug 30, 2024
@nattydodd nattydodd force-pushed the fix/unknown-type-execution-data branch from 40835b8 to e708ea3 Compare August 30, 2024 19:51
@nattydodd nattydodd force-pushed the fix/unknown-type-execution-data branch from e708ea3 to 3ff2828 Compare August 30, 2024 19:56
@nattydodd
Copy link
Contributor Author

/snapit

Copy link
Contributor

🫰✨ Thanks @nattydodd! Your snapshot has been published to npm.

Test the snapshot by updating your package.json with the newly published version:

"@shopify/graphql-testing": "0.0.0-snapshot-20240830200301"

Copy link
Member

@BPScott BPScott left a comment

Choose a reason for hiding this comment

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

Paired with Natalie on this fix.

Follow up to #2778. When shipping that PR I was testing in checkout-web which uses a forked version of graphql-testing so I never spotted the change in default behaviour for ExecutionResult where in graphql v15 shape of the TData generic allowed an object with the values any but in v16 it that was restricted to unknown, and thus that we need to explicitly state any.

@nattydodd nattydodd marked this pull request as ready for review August 30, 2024 20:23
@nattydodd nattydodd requested a review from a team as a code owner August 30, 2024 20:23
@BPScott BPScott merged commit e1fd441 into main Aug 30, 2024
5 checks passed
@BPScott BPScott deleted the fix/unknown-type-execution-data branch August 30, 2024 20:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants