fix: Improve Dispatcher.compose when nullish values are passed as argument#5443
fix: Improve Dispatcher.compose when nullish values are passed as argument#5443matthieusieben wants to merge 3 commits into
Dispatcher.compose when nullish values are passed as argument#5443Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5443 +/- ##
==========================================
+ Coverage 93.44% 93.47% +0.02%
==========================================
Files 110 110
Lines 37078 37108 +30
==========================================
+ Hits 34649 34688 +39
+ Misses 2429 2420 -9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
mcollina
left a comment
There was a problem hiding this comment.
can you update the type tests?
|
I've added tests, and also changed the implementation a bit to avoid returning a proxy object if no interceptor are actually provided |
Dispatcher.compose type definition to match implementationDispatcher.compose when nullish values are passed as argument
metcoder95
left a comment
There was a problem hiding this comment.
(guilty of implementing that) I believe is better to just not accept nullish values at all, it does not provides any value and now makes it look a bit odd as anyways the null values do not do anything at all.
Happy to keep this PR as is to avoid breaking changes, but maybe set a warning that preempts this behaviour will change in further major.
This relates to...
N/A
Rationale
The implementation of
Dispatcher.composeallows nullish values:undici/lib/dispatcher/dispatcher.js
Lines 23 to 25 in ae3efd4
This change alligns the type definitons with this to allow inline definitions:
Changes
Just updated the type definition of the arguments of
Dispatcher.composefromDispatcher.DispatcherComposeInterceptor[]to(null | undefined | Dispatcher.DispatcherComposeInterceptor)[]Features
N/A
Bug Fixes
N/A
Breaking Changes and Deprecations
N/A
Status