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

Adds type checking for GraphQL data payload #587

Merged
merged 2 commits into from
Feb 8, 2021

Conversation

dankremniov
Copy link
Contributor

@dankremniov dankremniov commented Feb 7, 2021

Basically, this PR partially reverts changes to the types made in 8f989ef.

Moreover, I added graphql.test-d.ts file for type definition tests using ts-expect-error which should help to ensure that graphql data response will not be broken by other refactorings in the future. Unfortunately, type checking (such as tsc --noEmit) is not a part of build pipeline at the moment, and, thus, the added tests will not stop build even if they are broken. However, this should be fixed by #579. But for now, they are only useful for TS errors in IDE. Let me know if you think that it does not make sense to have them in this PR and I will remove them.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 7, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit fedf608:

Sandbox Source
MSW React Configuration
currying-violet-03n18 Issue #574

@kettanaito
Copy link
Member

Hey, @dankremniov. Thank you for providing a fix for the GraphQL typings!

It looks great, I will check out your branch and give it a test tomorrow. That definition test looks amazing, thank you for adding it also. I believe #579 can help us in running that definition test as well.

@kettanaito kettanaito force-pushed the fix/graphql-data-payload-types branch from 39c4155 to 1434c90 Compare February 8, 2021 09:12
@kettanaito
Copy link
Member

I took this opportunity to annotate all graphql.* usage examples in our integration tests. This should help us catch at least some percentage of type-related violations upon test runs. Plus, it gives a nice example of how to annotate your GraphQL mocks.

Copy link
Member

@kettanaito kettanaito 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 for fixing this, @dankremniov! Welcome to contributors!

@kettanaito kettanaito merged commit d05f485 into mswjs:master Feb 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants