diff --git a/lib/tags.ts b/lib/tags.ts index 2a3b132..5879959 100644 --- a/lib/tags.ts +++ b/lib/tags.ts @@ -280,9 +280,14 @@ export type WithLifecycle = T & { effect(callback: Lifecycle.OnConnected): Lifecycle.OffConnected } -export let WithLifecycle = ( +export let WithLifecycle: ( + tagName: T, + newTagName?: `${string}-${string}` +) => { new (): WithLifecycle } = < + T extends keyof HTMLElementTagNameMap +>( tagname: T, - newTagName = `pure-${tagname}` as `${string}-${string}`, + newTagName = `pure-${tagname}`, constructor = custom.get(newTagName) as new () => WithLifecycle< HTMLElementTagNameMap[T] >