-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(type-utils): intersection types involving readonly arrays are now handled in most cases #4429
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(type-utils): intersection types involving readonly arrays are now handled in most cases #4429
Conversation
Thanks for the PR, @RebeccaStevens! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day. |
✔️ Deploy Preview for typescript-eslint ready! 🔨 Explore the source changes: bd475fb 🔍 Inspect the deploy log: https://app.netlify.com/sites/typescript-eslint/deploys/61e550ad525f4a000704eb25 😎 Browse the preview: https://deploy-preview-4429--typescript-eslint.netlify.app |
… handled in most cases fix typescript-eslint#4428
851b9be
to
ba0f0ac
Compare
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.
Thanks so much for handling this!
I merged your test PR first - just needs the conflict resolved and we can merge this!
Codecov Report
@@ Coverage Diff @@
## main #4429 +/- ##
==========================================
- Coverage 94.54% 92.73% -1.82%
==========================================
Files 147 161 +14
Lines 7851 8160 +309
Branches 2516 2621 +105
==========================================
+ Hits 7423 7567 +144
- Misses 234 392 +158
- Partials 194 201 +7
Flags with carried forward coverage won't be shown. Click here to find out more.
|
ugh. git is the worst. |
… handled in most cases (typescript-eslint#4429)
PR Checklist
Overview
isTypeReadonly
now handles intersection involving readonly arrays and tuples properly in most cases.The cases that aren't handled are those of that intersect a readonly array with an object that shares mutable properties with the array. For example:
Handling this in the general case may not be possible as we can't treat readonly arrays in nested intersections properly (at least not without a lot of work).
As a workaround, users can just wrap their intersection in
Readonly
if they come across this case.Note: This PR builds off #4416