From e92241c6466a13898b1ab7daa9ebfc4f2650bc69 Mon Sep 17 00:00:00 2001 From: "S. MohammadMahdi Zamanian" Date: Fri, 19 Apr 2024 22:08:55 +0330 Subject: [PATCH] fix(mixins): export as type --- packages/mixins/src/lib/schedule-update-to-frame.ts | 4 ++-- packages/mixins/src/lib/signal.ts | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/mixins/src/lib/schedule-update-to-frame.ts b/packages/mixins/src/lib/schedule-update-to-frame.ts index d74177f..53fecf8 100644 --- a/packages/mixins/src/lib/schedule-update-to-frame.ts +++ b/packages/mixins/src/lib/schedule-update-to-frame.ts @@ -1,7 +1,7 @@ import {cancelNextAnimationFrame, nextAnimationFrame} from '@gecut/utilities/wait/polyfill.js'; -import {SignalMixinInterface} from './signal.js'; - +// eslint-disable-next-line @typescript-eslint/consistent-type-imports +import type {SignalMixinInterface} from './signal.js'; import type {Constructor} from '@gecut/types'; export declare class ScheduleUpdateToFrameMixinInterface extends SignalMixinInterface {} diff --git a/packages/mixins/src/lib/signal.ts b/packages/mixins/src/lib/signal.ts index 1e15af8..57e00e4 100644 --- a/packages/mixins/src/lib/signal.ts +++ b/packages/mixins/src/lib/signal.ts @@ -12,18 +12,18 @@ export type MixinReturn = Constructor & T; export function SignalMixin>(superClass: T): MixinReturn { class SignalMixinClass extends superClass { // eslint-disable-next-line @typescript-eslint/no-explicit-any - private signalSubscribers: [Signal, Subscriber][] = []; + private signalSubscribers: ReturnType['subscribe']>[] = []; override disconnectedCallback(): void { super.disconnectedCallback(); - for (const [signal, subscriber] of this.signalSubscribers) { - signal.unsubscribe(subscriber); + for (const signalReturn of this.signalSubscribers) { + signalReturn.unsubscribe(); } } - protected addSignalSubscriber>(signal: S, subscriber: Subscriber): void { - this.signalSubscribers.push([signal, subscriber]); + protected addSignalSubscriber>(signalReturn: ReturnType): void { + this.signalSubscribers.push(signalReturn); } }