-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat(react-query): isLoading of type DefinedUseQueryResult is always false #3988
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
Conversation
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 1f9b626:
|
Why is the omit not required? It should be so that the type of data will be properly narrowed...? |
I'm not sure what case will it not be appropriately narrowed. type Prototype = { a: number | null };
type NewType = Prototype & { a: number };
type NewNeverType = Prototype & { a: string };
// OK
const a: NewType = { a: 0 };
// Error
const b: NewType = { a: null };
// Error, the type of property a is never
const c: NewNeverType = { a: '3' }; I think it will be fine. Besides, it can avoid using the type which is not in the prototype. Moreover, if I used |
Interesting! I'm pretty sure there was a time when you needed to remove a property from an object type before you could refine it, or the intersection wouldn't work properly. But I've tested this as far back as TS v3.3 and it all works fine 🤷 |
I'm still not sold on setting |
I think that could happen if given a type that does not extend from the original one. In that case |
In my opinion, I agree to remove the To be honest, the reason why I create this PR is that in my project I had used the previous version of It's not a big deal, I just think that still could happen to some other guys. With a strict type, maybe that could be avoided. Moreover, I can't see a reason to allow a type that will not exist. |
alright, please remove the |
Hi, I think I found a better way to solve this issue. The |
oh yeah I like that solution 👍 |
Codecov Report
@@ Coverage Diff @@
## main #3988 +/- ##
==========================================
+ Coverage 96.36% 96.81% +0.45%
==========================================
Files 45 57 +12
Lines 2281 2671 +390
Branches 640 784 +144
==========================================
+ Hits 2198 2586 +388
- Misses 80 83 +3
+ Partials 3 2 -1 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Since there is always cache data, the
isLoading
of typeDefinedUseQueryResult
should be false. Besides, theOmit
is not required.