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

fix(graphql): allow null for "data" and "errors" response property types #1867

Merged
merged 1 commit into from
Nov 17, 2023

Conversation

kettanaito
Copy link
Member

@kettanaito kettanaito commented Nov 17, 2023

Currently, providing null as the value of data or errors properties on the mocked GraphQL response causes a TypeScript error. That's because the types for those properties don't have the union with null:

export interface GraphQLResponseBody<BodyType extends DefaultBodyType> {
data?: BodyType
errors?: readonly Partial<GraphQLError>[]
}

This also makes them incompatible with the ExecutionResult from the graphql package.

@kettanaito kettanaito changed the title fix(graphql): allow null as "data" and "errors" response values fix(graphql): allow null for "data" and "errors" response property types Nov 17, 2023
@kettanaito kettanaito merged commit a7ffd32 into main Nov 17, 2023
10 checks passed
@kettanaito kettanaito deleted the fix/ts-graphql-body-type branch November 17, 2023 09:49
@kettanaito
Copy link
Member Author

Released: v2.0.8 🎉

This has been released in v2.0.8!

Make sure to always update to the latest version (npm i msw@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.

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.

None yet

1 participant