refactor(resources): fix eslint warning#5383
refactor(resources): fix eslint warning#5383pichlermarc merged 3 commits intoopen-telemetry:mainfrom
Conversation
``` /home/runner/work/opentelemetry-js/opentelemetry-js/packages/opentelemetry-resources/src/utils.ts 17:39 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any ``` Ref open-telemetry#5365
| val !== null && | ||
| typeof val === 'object' && | ||
| typeof (val as Partial<PromiseLike<R>>).then === 'function' | ||
| ); |
There was a problem hiding this comment.
Adding 'then' in val to the existing chain would also work (instead of doing the cast), and sometimes I prefer that for readability. However that does impose a tiny bit of additional runtime cost so I avoided it here.
There was a problem hiding this comment.
@david-luna resolved
For context: #5350 landed a similar fix so this PR isn't strictly necessary anymore, if the only goal is to get rid of the any (which #5350 did). This is slightly more precise and matches the intention of the code better.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5383 +/- ##
=======================================
Coverage 94.79% 94.79%
=======================================
Files 310 310
Lines 7969 7969
Branches 1679 1679
=======================================
Hits 7554 7554
Misses 415 415
|
david-luna
left a comment
There was a problem hiding this comment.
@chancancode could you please resolve the conflict? Thanks
Which problem is this PR solving?
Fix the following eslint warning in the resources package:
Ref #5365
Short description of the changes
Use
unknowninstead.Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist: