// Exposes a Web Component that is registered using: // customElements.define("x-example", ExampleElement) declare global { interface CustomElementRegistry { get(name: "x-example"): typeof ExampleElement | undefined; } } // No need to import the type or typecast the constructor anymore, // Intellisense recognizes its properties and methods const ExampleElement = customElements.get("x-example"); if (ExampleElement) { const element = new ExampleElement(); console.log(element.myprop); document.body.appendChild(element); }