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

Add more accurate typings to formatError #2343

Merged
merged 4 commits into from
Feb 21, 2019
Merged

Conversation

cheapsteak
Copy link
Member

@cheapsteak cheapsteak commented Feb 19, 2019

Related to #2294

This updates the typings for formatError to specify that it accepts an GraphQLError as an argument, and expects a GraphQLFormattedError to be returned

TODO:

  • Update CHANGELOG.md with your change (include reference to issue & this PR)
  • Make sure all of the significant new logic is covered by tests (NA?)
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass

@cheapsteak cheapsteak added the 🧬 typings Relates to TypeScript changes or improvements. label Feb 19, 2019
@martijnwalraven
Copy link
Contributor

Thanks for making the typing of formatError more specific, we should definitely stop using Function. It doesn't actually take and return ApolloError however, but instead takes GraphQLError and returns GraphQLFormattedError, similar to formatError from graphql-js: https://github.com/graphql/graphql-js/blob/f205c99c676bb71b9c5c043e574a5c96856fc265/src/error/formatError.js#L18

@cheapsteak
Copy link
Member Author

Ah, thanks for the clarification, I'll update that

@cheapsteak cheapsteak force-pushed the chang/formatError-typing branch from 13c9a6a to bae1c82 Compare February 20, 2019 21:22
@cheapsteak
Copy link
Member Author

Updated, please take another look once you have a chance 🙏

@abernix abernix changed the title Type formatError to specify that it both accepts and returns an ApolloError Add more accurate typings to formatError Feb 21, 2019
Copy link
Member

@abernix abernix left a comment

Choose a reason for hiding this comment

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

LGTM!

@cheapsteak cheapsteak merged commit 8850e0f into master Feb 21, 2019
@cheapsteak cheapsteak deleted the chang/formatError-typing branch February 21, 2019 14:10
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🧬 typings Relates to TypeScript changes or improvements.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants