Skip to content

Commit

Permalink
fix(widget-element): fix generic
Browse files Browse the repository at this point in the history
  • Loading branch information
andrepolischuk committed Sep 9, 2024
1 parent 70278b5 commit 4e071b4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/widget-element/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
/* eslint-disable import/no-unused-modules */

type NonFunctionProperties<T> = {
// eslint-disable-next-line @typescript-eslint/ban-types
[K in keyof T as T[K] extends Function ? never : K]: T[K]
}

/**
* Custom Element that helps you to create widgets.
*
Expand Down Expand Up @@ -68,9 +73,7 @@
* </script>
* ```
*/
export class WidgetElement<
T extends Record<string, any> = Record<string, any>
> extends HTMLElement {
export class WidgetElement<T = any> extends HTMLElement {
#fallback!: HTMLElement
#shadowRoot?: ShadowRoot

Expand All @@ -83,7 +86,7 @@ export class WidgetElement<
}

/** Widget custom element constructor */
constructor(properties?: T) {
constructor(properties?: NonFunctionProperties<T>) {
super()

const {observedAttributes} = this.constructor as any
Expand Down

0 comments on commit 4e071b4

Please sign in to comment.