Skip to content
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

refactor(sdk-trace-web): fix eslint warning #5388

Merged

Conversation

chancancode
Copy link
Contributor

Which problem is this PR solving?

/home/runner/work/opentelemetry-js/opentelemetry-js/packages/opentelemetry-sdk-trace-web/src/utils.ts
  52:14  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

Ref #5365

Short description of the changes

The eslint comment wasn't working because it was placed on the wrong line. However, it also wasn't necessary anymore – keyof any was used to obtain the union of all possible object key types – string | number | symbol. TypeScript now provides an alias for this in the standard libaray that gives exactly the same result.

Also fixed what appears to be a TypeError on an un-annotated let binding, not sure why it wasn't caught by the type checker, maybe it was just missed on the version of TS we are using.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

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

  • eslint
  • TypeScript

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

```
/home/runner/work/opentelemetry-js/opentelemetry-js/packages/opentelemetry-sdk-trace-web/src/utils.ts
  52:14  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
```

The eslint comment wasn't working because it was placed on the
wrong line. However, it also wasn't necessary anymore – `keyof any`
was used to obtain the union of all possible object key types –
`string | number | symbol`. TypeScript now provides an alias for
this in the standard libaray that gives exactly the same result.

Also fixed what appears to be a TypeError on an un-annotated `let`
binding, not sure why it wasn't caught by the type checker, maybe
it was just missed on the version of TS we are using.

Ref open-telemetry#5365
@chancancode chancancode requested a review from a team as a code owner January 28, 2025 22:13
@chancancode chancancode mentioned this pull request Jan 28, 2025
25 tasks
Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.63%. Comparing base (199fd8d) to head (8ef7e8b).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5388   +/-   ##
=======================================
  Coverage   94.63%   94.63%           
=======================================
  Files         318      318           
  Lines        8036     8036           
  Branches     1685     1685           
=======================================
  Hits         7605     7605           
  Misses        431      431           

Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks 👍

@pichlermarc pichlermarc added this pull request to the merge queue Jan 29, 2025
Merged via the queue into open-telemetry:main with commit 682ab65 Jan 29, 2025
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants