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(types): adapt type definition of dataOrUpdater in setQueryData #540

Merged
merged 1 commit into from
Jun 2, 2020
Merged

Conversation

TkDodo
Copy link
Collaborator

@TkDodo TkDodo commented Jun 2, 2020

closes #506

since the updater receives `T | undefined`, it is difficult to construct a `T` from that. oldData can legitimately be `undefined`, but since `getQueryData` can also return `undefined` at any point, it makes more sense to have the updater be able to return `undefined` as well, which also means that `data` itself can be `undefined`
@TkDodo
Copy link
Collaborator Author

TkDodo commented Jun 2, 2020

Not sure what I should do against the broken link checker, this seems unrelated:

HTTPSConnectionPool(host='upc.ch', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])")))
https://upc.ch

Also, some more questions please:

  1. is dtslint part of the PR checks? I am getting a bunch of errors locally:
see `dtslint` errors
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
  1. Should I add some tests to types/test.ts for the type amendments I have made?

  2. the format script doesn't format .ts files (and doesn't run on the types directory in general), which is why the types/test.ts file is not formatted with it. Is this worth addressing or is this maybe on purpose?

Thanks

@tannerlinsley
Copy link
Collaborator

  1. It's not, but I'd like to get them fixed anyway. Low priority.
  2. If you'd like! More tests can't hurt.
  3. Again, I would love to update that, but it's low priority.

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

🎉 This PR is included in version 1.5.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

typeDefinition of updater function in setQueryData
2 participants