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(utils): accept null as default option in applyDefault
#6724
fix(utils): accept null as default option in applyDefault
#6724
Conversation
Thanks for the PR, @Solo-steven! 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. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #6724 +/- ##
=======================================
Coverage 87.47% 87.47%
=======================================
Files 379 379
Lines 13228 13228
Branches 3905 3905
=======================================
Hits 11571 11571
Misses 1279 1279
Partials 378 378
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
I guess the question here is whether or not an explicit null
should be ignored like this and overridden by the default, or if it should be seen as a value that shouldn't be overridden.
I think an explicit null
should not be overridden, personally.
@bradzacher Thanks for your reply, I think another solution is adding one more conditional to function isObjectNotArray<T extends ObjectLike>(
obj: unknown | unknown[],
): obj is T {
return typeof obj === 'object' && obj != null && !Array.isArray(obj);
} this solution wouldn't overwrite the null value . But I want to know why we shouldn't overwrite the value, is it cause more errors? |
If a user does a config like Instead I think that we should only override |
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.
Nice, thanks for this!
Oh 🤦 my GitHub did a weird and I didn't see @bradzacher's comments. Ignore me, and sorry for the force pushing! |
9385b03
to
0d36ce5
Compare
👋 @bradzacher I think this got dropped from the queue because I did a silly. Do you want to review this one? It looks good to me, but just making sure. |
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! And, sorry for the long wait!
applyDefault
PR Checklist
Overview
fix issue #6439