-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
lib: add options to util.deprecate #59982
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
lib: add options to util.deprecate #59982
Conversation
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.
#44711 didn't add a test case for sync emit deprecation. I believe the original intention was that the new option is an internal option.
I also personally believe that the public api should keep the signature util.deprecate(fn, msg[, code]) as is.
Currently, they aren't. We are exposing the same |
yes, you are right that |
|
@legendecas the Since I was about to expose the What's your suggestion? Exposing both or exposing just modifyPrototype? |
|
We need test coverages. I searched the I'd think a public API exposing these options in an option bag could be future proof. Instead of positional args. |
|
I concur. I will adjust that. |
c58f871 to
7877556
Compare
7877556 to
5d320f1
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #59982 +/- ##
==========================================
- Coverage 88.55% 88.54% -0.02%
==========================================
Files 704 704
Lines 207989 207994 +5
Branches 40068 40076 +8
==========================================
- Hits 184180 184158 -22
- Misses 15841 15855 +14
- Partials 7968 7981 +13
🚀 New features to boost your workflow:
|
|
|
||
| // Public util.deprecate API | ||
| function deprecate(fn, msg, code, { modifyPrototype } = {}) { | ||
| return internalDeprecate(fn, msg, code, undefined, modifyPrototype); |
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.
doesn't this mean it's a breaking change?
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.
These are not a documented argument. Do you have a package in mind that will be broken by this undocumented behavior?
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.
Nope, but whether it's documented or not generally has no effect on whether something is theoretically breaking.
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.
We would not consider fixing an undocumented behavior as an effective breaking change if the impact is trivial. This is one of the main reason that we need a public API contract such as documentation.
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
ab7e810 to
5ae64ea
Compare
|
I had to rebase on main as OSX was failing constantly. |
|
Landed in cfa11ba |
It seems this was missed in the PRs that added both options.
cc: @legendecas