Skip to content

Commit

Permalink
refactor(context-zone-peer-dep): fix eslint warnings
Browse files Browse the repository at this point in the history
    /home/runner/work/opentelemetry-js/opentelemetry-js/packages/opentelemetry-context-zone-peer-dep/src/util.ts
      22:39  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

Ref open-telemetry#5365
  • Loading branch information
chancancode committed Jan 24, 2025
1 parent f927e82 commit e535f4a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/opentelemetry-context-zone-peer-dep/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@
*/

/**
* check if an object has addEventListener and removeEventListener functions then it will return true.
* Generally only called with a `TargetWithEvents` but may be called with an unknown / any.
* check if an object has `addEventListener` and `removeEventListener` functions.
* Generally only called with a `TargetWithEvents` but may be called with an `unknown` value.
* @param obj - The object to check.
*/
export function isListenerObject(obj: any = {}): boolean {
export function isListenerObject(obj: unknown): boolean {
return (
typeof obj === 'object' &&
obj !== null &&
'addEventListener' in obj &&
typeof obj.addEventListener === 'function' &&
'removeEventListener' in obj &&
typeof obj.removeEventListener === 'function'
);
}

0 comments on commit e535f4a

Please sign in to comment.