After taking a break from my project for a year, I came back to find that certain code which used to work is now causing issues:
interface HTMLElement {
attributeChangedCallback(attributeName: string, oldValue: string, newValue: string): void;
connectedCallback(): void;
disconnectedCallback(): void;
observedAttributes: string[];
}
export default class TestElement extends HTMLElement {
connectedCallback(): void {
super.connectedCallback();
}
}
An error message stating
Property 'connectedCallback' does not exist on type 'HTMLElement'
is now appearing. Even though I am extending the HTMLElement
class directly, the default declarations for HTMLElement
do not include any of the custom element functions. I have been using an interface to compensate for this absence. Is there something else I need to do in order to make it work correctly?