diff --git a/packages/signals/signals/src/core/signal-generators/dom-gen/mutation-observer.ts b/packages/signals/signals/src/core/signal-generators/dom-gen/mutation-observer.ts index fc0e12486..0017614b2 100644 --- a/packages/signals/signals/src/core/signal-generators/dom-gen/mutation-observer.ts +++ b/packages/signals/signals/src/core/signal-generators/dom-gen/mutation-observer.ts @@ -148,7 +148,7 @@ export class MutationObservable { private settings: MutationObservableSettings // Track observed elements to avoid duplicate observers // WeakSet is used here to allow garbage collection of elements that are no longer in the DOM - private observedElements = new WeakSet() + private observedElements = new WeakSet() private prevMutationsCache = new WeakMap() private emitter = new ElementChangedEmitter() private listeners = new Set() @@ -296,7 +296,7 @@ export class MutationObservable { allElementSelectors.forEach((selector) => { const elements = document.querySelectorAll(selector) elements.forEach((element) => { - if (this.observedElements.has(element)) { + if (this.observedElements.has(element as HTMLElement)) { return } logger.debug('Observing element', element)