Skip to content

Commit

Permalink
refactor(context-zone-peer-dep): fix eslint warnings (#5371)
Browse files Browse the repository at this point in the history
  • Loading branch information
chancancode authored Feb 13, 2025
1 parent 7a1e1b2 commit c27fbc6
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 c27fbc6

Please sign in to comment.