-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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): infer the narrowest type with queryOptions
#5805
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
☁️ Nx Cloud ReportCI is running/has finished running commands for commit f0bc02d. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
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 f0bc02d:
|
Codecov ReportPatch coverage has no change and project coverage change:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## beta #5805 +/- ##
==========================================
- Coverage 97.11% 89.07% -8.05%
==========================================
Files 50 30 -20
Lines 2391 421 -1970
Branches 706 89 -617
==========================================
- Hits 2322 375 -1947
+ Misses 67 42 -25
- Partials 2 4 +2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️🙏
@Andarist it seems that with this change, we lost excess property checks on the We don't have a test for this, but I tried it out with the version from before that PR, and there, it used to work 🤔 |
This gets tricky - the inferred type is always exempt from the excess property check. We need to remember that the excess property check is more like a lint rule than anything else. If you want to eat cake and have it too then perhaps this self-validation technique is your best bet: TS playground. Other than that... a bizarre thing like this could work: TS playground. This infers each property separately~ to ensure that they were present in the input. Thanks to that we can keep the excess property check "as is" because the target object that is meant to report it is not the target of inference on its own. More work/thought would have to be put into this one to handle the optionality of input properties correctly. |
uuh, let me try out the |
fixes #5436