/// import type { EventEmitter } from 'events'; import type { Constructor } from 'clone-class'; import type { WechatyMixinProtectedProperty } from '../wechaty-mixins/mod.js'; import type { WechatyEventListeners } from '../schemas/mod.js'; import type { WechatySkeletonProtectedProperty } from './wechaty-skeleton.js'; import { WechatyBase, WechatyBaseProtectedProperty } from './wechaty-base.js'; declare const WechatyImplBase_base: { new (...args: any[]): {}; valid: (o: any) => o is WechatyImplInterface; validInstance: (target: any) => target is WechatyBase; validInterface: (target: any) => target is WechatyImplInterface; } & typeof WechatyBase; /** * Huan(202111): this is for solving the circyle dependency problem * * Construct a `WechatyImpl` based the `WechatyImplBase` with `validationMixin` * */ declare class WechatyImplBase extends WechatyImplBase_base { } interface WechatyImplInterface extends WechatyImplBase { } declare const WechatyImpl_base: { new (...args: any[]): {}; valid: (o: any) => o is WechatyInterface; validInstance: (target: any) => target is WechatyImplBase; validInterface: (target: any) => target is WechatyInterface; } & typeof WechatyImplBase; declare class WechatyImpl extends WechatyImpl_base { } /** * ^ The above code will make a ready-to-use class: `WechatyImpl` * without any cyclic dependency problem. */ declare type AllProtectedProperty = keyof EventEmitter | WechatyMixinProtectedProperty | WechatyBaseProtectedProperty | WechatySkeletonProtectedProperty | `_${string}`; /** * Huan(202111): * `on`/`off`/`once` must use TypedEventEmitter instead of WechatyImpl * or will run into error: cyclic dependency? */ interface WechatyEventEmitter { on: (event: E, listener: WechatyEventListeners[E]) => WechatyInterface; off: (event: E, listener: WechatyEventListeners[E]) => WechatyInterface; once: (event: E, listener: WechatyEventListeners[E]) => WechatyInterface; } declare type WechatyInterface = Omit & WechatyEventEmitter; declare type WechatyConstructor = Constructor; export { type WechatyInterface, type WechatyConstructor, type AllProtectedProperty, WechatyImpl, }; //# sourceMappingURL=wechaty-impl.d.ts.map