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 error types #525

Merged
merged 2 commits into from
Jun 2, 2020
Merged

Conversation

thebuilder
Copy link
Contributor

This improves the error types as outlined in #483.

It allows you to define the expected type of an error, while defaulting to Error.

useQuery<TResult, TKey, TVariables, TError>()

Todo

[ ] Add appropriate type tests

Question

Currently running dtslint creates a few warnings. Are these expected?
After adding TError to prefetch methods, I've also generated a few more warnings about unnecessary generics (https://github.com/Microsoft/dtslint/blob/master/docs/no-unnecessary-generics.md).

ERROR: 621:44  no-unnecessary-generics  Type parameter TError is used only once. See: https://github.com/Microsoft/dtslint/blob/master/docs/no-unnecessary-generics.md
ERROR: 632:44  no-unnecessary-generics  Type parameter TError is used only once. See: https://github.com/Microsoft/dtslint/blob/master/docs/no-unnecessary-generics.md
ERROR: 649:44  no-unnecessary-generics  Type parameter TError is used only once. See: https://github.com/Microsoft/dtslint/blob/master/docs/no-unnecessary-generics.md
ERROR: 661:44  no-unnecessary-generics  Type parameter TError is used only once. See: https://github.com/Microsoft/dtslint/blob/master/docs/no-unnecessary-generics.md
ERROR: 683:44  no-unnecessary-generics  Type parameter TError is used only once. See: https://github.com/Microsoft/dtslint/blob/master/docs/no-unnecessary-generics.md
ERROR: 686:57  no-unnecessary-generics  Type parameter T is used only once. See: https://github.com/Microsoft/dtslint/blob/master/docs/no-unnecessary-generics.md
ERROR: 701:14  no-unnecessary-generics  Type parameter TResult is used only once. See: https://github.com/Microsoft/dtslint/blob/master/docs/no-unnecessary-generics.md

@tannerlinsley tannerlinsley merged commit e5f0bb3 into TanStack:master Jun 2, 2020
@tannerlinsley
Copy link
Collaborator

🎉 This PR is included in version 1.5.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@thebuilder thebuilder deleted the add-error-types branch June 8, 2020 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants