fix(scoped-elements): add constructor to type definition

This commit is contained in:
Joren Broekema
2021-01-13 16:19:55 +01:00
committed by Thomas Allmer
parent 3183c5bd33
commit 31ff454a87
2 changed files with 14 additions and 6 deletions

View File

@@ -0,0 +1,5 @@
---
'@open-wc/scoped-elements': patch
---
Add constructor to ScopedElementsHost type so that base constructors have the same return type as extensions. See [TypeScript issue](https://github.com/microsoft/TypeScript/issues/40110).

View File

@@ -1,11 +1,12 @@
import { Constructor } from "@open-wc/dedupe-mixin";
import { LitElement } from "lit-element";
import { Constructor } from '@open-wc/dedupe-mixin';
import { LitElement } from 'lit-element';
export type ScopedElementsMap = {
[key: string]: typeof HTMLElement;
}
[key: string]: typeof HTMLElement;
};
export declare class ScopedElementsHost {
constructor(...args: any[]);
/**
* Obtains the scoped elements definitions map
*/
@@ -24,9 +25,11 @@ export declare class ScopedElementsHost {
/**
* Defines a scoped element
*/
defineScopedElement<T extends HTMLElement>(tagName: string, klass: Constructor<T>): void
defineScopedElement<T extends HTMLElement>(tagName: string, klass: Constructor<T>): void;
}
declare function ScopedElementsMixinImplementation<T extends Constructor<LitElement>>(superclass: T): T & Constructor<ScopedElementsHost> & typeof ScopedElementsHost
declare function ScopedElementsMixinImplementation<T extends Constructor<LitElement>>(
superclass: T,
): T & Constructor<ScopedElementsHost> & typeof ScopedElementsHost;
export type ScopedElementsMixin = typeof ScopedElementsMixinImplementation;