diff --git a/mixin.d.ts b/mixin.d.ts index 8e650c4..6eb1775 100644 --- a/mixin.d.ts +++ b/mixin.d.ts @@ -11,7 +11,7 @@ export type RenderOptions = { reflect: boolean }; -declare abstract class AHoquet extends HTMLElement { +declare abstract class AHoquet { getElementById (id: string): HTMLElement | null; render (options?: RenderOptions): void; get rendered (): boolean; @@ -20,6 +20,6 @@ declare abstract class AHoquet extends HTMLElement { fragment (...src): DocumentFragment; } -export default function HTMLElement> - (c: T, options?: ConstructorOptions): new (...args) => AHoquet; +type makeFn = (el: T1, opts?: ConstructorOptions) => InstanceType & AHoquet; +export default makeFn; diff --git a/mixin.js b/mixin.js index 0c19d43..308d50a 100644 --- a/mixin.js +++ b/mixin.js @@ -41,7 +41,7 @@ export default ((C = HTMLElement, { ? function(id) { return this.shadowRoot.getElementById(id); } : function(id) { return this.querySelector(`#${id}`); }; - class A extends (C) { + return new (class A extends (C) { constructor(...args) { super(...args); @@ -203,8 +203,6 @@ export default ((C = HTMLElement, { adoptStyleSheets(...sources) { return !sources.length || _importStyleRules(this[CONTAINER_KEY], sources, shadowy); } - } - - return A; + }) });