refactor(context-zone-peer-dep): fix eslint warnings (#5371)

This commit is contained in:
Godfrey Chan 2025-02-13 11:33:33 -08:00 committed by GitHub
parent 7a1e1b274f
commit c27fbc6d49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 3 deletions

View File

@ -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'
);
}