From 24de30357ff0690cd200c7171b87a56fc299ddef Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Sat, 7 Dec 2024 20:21:38 +0330 Subject: [PATCH] fix(element/logging): use interface for mixin type --- packages/element/src/mixin/logging.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/element/src/mixin/logging.ts b/packages/element/src/mixin/logging.ts index 10c7ab9..6c9daad 100644 --- a/packages/element/src/mixin/logging.ts +++ b/packages/element/src/mixin/logging.ts @@ -3,13 +3,13 @@ import {createLogger, type AlwatrLogger} from '@alwatr/logger'; import type {Class} from '@alwatr/type-helper'; import type {LitElement, PropertyValues} from 'lit'; -// Global element index to uniquely identify each element instance +/** + * Global element index to uniquely identify each element instance + */ let elementIndex = /* @__PURE__ */ 0; -// Declaration of the LoggerMixinInterface class extending LitElement -export declare class LoggerMixinInterface extends LitElement { - // Logger instance for the element - protected logger_: AlwatrLogger; +export interface LoggerMixinInterface extends LitElement { + logger_: AlwatrLogger; } /** @@ -35,7 +35,7 @@ export declare class LoggerMixinInterface extends LitElement { export function LoggerMixin = Class>( superClass: T, ): Class & T { - class MixinClass extends superClass { + return class MixinClass extends superClass { // Unique index for each element instance private elementIndex__: number = ++elementIndex; @@ -105,7 +105,5 @@ export function LoggerMixin = Class>( this.logger_.logMethod?.('remove'); super.remove(); } - } - - return MixinClass as unknown as Class & T; + } as unknown as Class & T; }