I have an app with vanilla custom elements, like this:
class CardComponent extends HTMLElement {
static get observedAttributes() {
return ['header', 'text'];
}
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
connectedCallback() {
...
}
attributeChangedCallback(_name : string, _oldValue : string, _newValue : string) {
...
}
render() {
...
}
}
Now, I have no TypeScript support and method definitions for these methods, since they are not part of the HTMLElement interface. Also haven't found a library that adds that support (like for example @types/node that adds Node.js type definitions).
The only method that has documentation is attachShadow:

How to add support?
document.querySelector('.my-card')can be used with generics e.g.document.querySelector<CardComponent>('.my-card')this is not just for custom HTML elements, it also allows you to use functionality specific to things likeHTMLFormElementetc. It's not clear how you actually use your elements here so I don't know if this suggestion is appropriate for your use caselib.dom.d.tsfile already contains :declare var HTMLElement: {prototype: HTMLElement;new(): HTMLElement;}So actually they do contain the element that I'm based on, but it does not contain the interfaces I'm interested in. And I don't wan't to "monkey patch" the typescript basic modules.