fix(ui): type fixes ScopedElements
This commit is contained in:
parent
ea71f6194b
commit
8fd440d9d0
2 changed files with 21 additions and 0 deletions
|
|
@ -35,6 +35,7 @@ import { ScopedElementsMixin as OpenWcLitScopedElementsMixin } from '@open-wc/sc
|
|||
* @typedef {typeof import('lit').LitElement} TypeofLitElement
|
||||
* @typedef {import('@open-wc/dedupe-mixin').Constructor<LitElement>} LitElementConstructor
|
||||
* @typedef {import('@open-wc/dedupe-mixin').Constructor<ScopedElementsHost>} ScopedElementsHostConstructor
|
||||
* @typedef {import('./types.js').ScopedElementsHostV2Constructor} ScopedElementsHostV2Constructor
|
||||
*/
|
||||
|
||||
const supportsScopedRegistry = Boolean(
|
||||
|
|
@ -45,6 +46,7 @@ const supportsScopedRegistry = Boolean(
|
|||
/**
|
||||
* @template {LitElementConstructor} T
|
||||
* @param {T} superclass
|
||||
* @return {T & ScopedElementsHostConstructor & ScopedElementsHostV2Constructor}
|
||||
*/
|
||||
const ScopedElementsMixinImplementation = superclass =>
|
||||
/** @type {ScopedElementsHost} */
|
||||
|
|
|
|||
19
packages/ui/components/core/src/types.ts
Normal file
19
packages/ui/components/core/src/types.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// Note. This file is a partial copy of https://github.com/open-wc/open-wc/blob/scoped-elements-v2/packages/scoped-elements/src/types.d.ts
|
||||
|
||||
import { Constructor } from '@open-wc/dedupe-mixin';
|
||||
|
||||
export declare class ScopedElementsHostV2 {
|
||||
/**
|
||||
* Defines a scoped element inside the CustomElementRegistry bound to the shadowRoot.
|
||||
*/
|
||||
defineScopedElement<T extends HTMLElement>(tagName: string, klass: Constructor<T>): void;
|
||||
|
||||
/**
|
||||
* Create a scoped element inside the CustomElementRegistry bound to the shadowRoot.
|
||||
*
|
||||
* @param tagName string The tag name of the element to create
|
||||
*/
|
||||
createScopedElement(tagName: string): HTMLElement;
|
||||
}
|
||||
|
||||
export type ScopedElementsHostV2Constructor = Constructor<ScopedElementsHostV2>;
|
||||
Loading…
Reference in a new issue