fastevent 2.2.7 → 2.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -274,6 +274,9 @@ type Overloads<T> = Unique<T extends {
274
274
  T
275
275
  ]>;
276
276
  type Dict<V = any> = Record<Exclude<string, number | symbol>, V>;
277
+ type Union<T> = T extends infer O ? {
278
+ [K in keyof O]: O[K];
279
+ } : never;
277
280
 
278
281
  type FastEventBusMessage<Events extends Record<string, any> = Record<string, any>, M = any> = FastEventEmitMessage<Events, M> & {
279
282
  from?: string;
@@ -311,7 +314,7 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
311
314
  anyListener: TypedFastEventAnyListener<Events, FinalMeta, Fallback<Context, typeof this>>;
312
315
  };
313
316
  prefix: string;
314
- emitter: FastEvent<Events>;
317
+ emitter: FastEvent<any>;
315
318
  constructor(options?: DeepPartial<FastEventScopeOptions<FinalMeta, Context>>);
316
319
  get context(): Fallback<Context, typeof this>;
317
320
  get options(): FastEventScopeOptions<FinalMeta, Context>;
@@ -359,9 +362,9 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
359
362
  emit(type: Types, directive: symbol): void;
360
363
  emit(type: string, directive: symbol): void;
361
364
  emit<R = any, T extends Types = Types>(type: T, payload?: Events[T], retain?: boolean): R[];
362
- emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? Events[Types] : any, retain?: boolean): R[];
365
+ emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? Events[T] : any, retain?: boolean): R[];
363
366
  emit<R = any>(type: Types, payload?: Events[Types], options?: FastEventListenerArgs<FinalMeta>): R[];
364
- emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? Events[Types] : any, options?: FastEventListenerArgs<FinalMeta>): R[];
367
+ emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? Events[T] : any, options?: FastEventListenerArgs<FinalMeta>): R[];
365
368
  emit<R = any>(message: FastEventEmitMessage<Events, FinalMeta>, options?: FastEventListenerArgs<FinalMeta>): R[];
366
369
  emit<R = any, T extends string = string>(message: FastEventEmitMessage<{
367
370
  [K in T]: K extends Types ? Events[K] : any;
@@ -428,7 +431,7 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
428
431
  * @template Meta - 事件元数据类型,默认为任意键值对对象
429
432
  * @template Types - 事件类型的键名类型,默认为Events的键名类型
430
433
  */
431
- declare class FastEvent<Events extends Record<string, any> = Record<string, any>, Meta extends Record<string, any> = Record<string, any>, Context = never, AllEvents extends Record<string, any> = Events & FastEvents, Types extends keyof AllEvents = Expand<Exclude<keyof (AllEvents), number | symbol>>> {
434
+ declare class FastEvent<Events extends Record<string, any> = Record<string, any>, Meta extends Record<string, any> = Record<string, any>, Context = never, AllEvents extends Record<string, any> = Expand<Events & FastEvents>, Types extends keyof AllEvents = Expand<Exclude<keyof AllEvents, number | symbol>>> {
432
435
  __FastEvent__: boolean;
433
436
  /** 事件监听器树结构,存储所有注册的事件监听器 */
434
437
  listeners: FastListeners;
@@ -750,13 +753,13 @@ declare class FastEvent<Events extends Record<string, any> = Record<string, any>
750
753
  emit<T extends Types = Types>(type: T, directive: symbol): any[];
751
754
  emit(type: string, directive: symbol): any[];
752
755
  emit<R = any, T extends Types = Types>(type: T, payload?: AllEvents[T], retain?: boolean): R[];
753
- emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? AllEvents[Types] : any, retain?: boolean): R[];
756
+ emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? AllEvents[T] : any, retain?: boolean): R[];
754
757
  emit<R = any, T extends string = string>(message: FastEventEmitMessage<{
755
758
  [K in T]: K extends Types ? AllEvents[K] : any;
756
759
  }, Meta>, retain?: boolean): R[];
757
760
  emit<R = any>(message: FastEventEmitMessage<AllEvents, Meta>, retain?: boolean): R[];
758
761
  emit<R = any, T extends Types = Types>(type: T, payload?: AllEvents[T], options?: FastEventListenerArgs<Meta>): R[];
759
- emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? AllEvents[Types] : any, options?: FastEventListenerArgs<Meta>): R[];
762
+ emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? AllEvents[T] : any, options?: FastEventListenerArgs<Meta>): R[];
760
763
  emit<R = any, T extends string = string>(message: FastEventEmitMessage<{
761
764
  [K in T]: K extends Types ? AllEvents[K] : any;
762
765
  }, Meta>, options?: FastEventListenerArgs<Meta>): R[];
@@ -1149,4 +1152,4 @@ declare function isClass(target: unknown): target is new (...args: any[]) => any
1149
1152
 
1150
1153
  declare function isFastEvent(target: any): target is FastEvent;
1151
1154
 
1152
- export { AbortError, BroadcastEvent, CancelError, type ChangeFieldType, type DeepPartial, type Dict, type Expand, type Fallback, FastEvent, FastEventBus, type FastEventBusEventTypes, type FastEventBusEvents, type FastEventBusMessage, FastEventBusNode, type FastEventBusNodeIds, type FastEventBusNodeOptions, type FastEventBusNodes, type FastEventBusOptions, FastEventDirectives, type FastEventEmitMessage, FastEventError, type FastEventListenOptions, type FastEventListener, type FastEventListenerArgs, type FastEventListeners, type FastEventMessage, type FastEventMessageExtends, type FastEventMeta, type FastEventOptions, FastEventScope, type FastEventScopeMeta, type FastEventScopeOptions, type FastEventSubscriber, type FastEvents, type FastListenerMeta, type FastListenerNode, type FastListeners, type Merge, NamespaceDelimiter, NodeDataEvent, type ObjectKeys, type OptionalItems, type Overloads, type OverrideOptions, type PickScopeEvents, QueueOverflowError, type RequiredItems, type ScopeEvents, TimeoutError, type TypedFastEventAnyListener, type TypedFastEventListener, type TypedFastEventMessage, type TypedFastEventMessageOptional, UnboundError, type Unique, __FastEventScope__, __FastEvent__, __expandable__, expandable, isClass, isExpandable, isFastEvent, isFastEventMessage, isFastEventScope, isFunction, isPathMatched, isString, isSubsctiber };
1155
+ export { AbortError, BroadcastEvent, CancelError, type ChangeFieldType, type DeepPartial, type Dict, type Expand, type Fallback, FastEvent, FastEventBus, type FastEventBusEventTypes, type FastEventBusEvents, type FastEventBusMessage, FastEventBusNode, type FastEventBusNodeIds, type FastEventBusNodeOptions, type FastEventBusNodes, type FastEventBusOptions, FastEventDirectives, type FastEventEmitMessage, FastEventError, type FastEventListenOptions, type FastEventListener, type FastEventListenerArgs, type FastEventListeners, type FastEventMessage, type FastEventMessageExtends, type FastEventMeta, type FastEventOptions, FastEventScope, type FastEventScopeMeta, type FastEventScopeOptions, type FastEventSubscriber, type FastEvents, type FastListenerMeta, type FastListenerNode, type FastListeners, type Merge, NamespaceDelimiter, NodeDataEvent, type ObjectKeys, type OptionalItems, type Overloads, type OverrideOptions, type PickScopeEvents, QueueOverflowError, type RequiredItems, type ScopeEvents, TimeoutError, type TypedFastEventAnyListener, type TypedFastEventListener, type TypedFastEventMessage, type TypedFastEventMessageOptional, UnboundError, type Union, type Unique, __FastEventScope__, __FastEvent__, __expandable__, expandable, isClass, isExpandable, isFastEvent, isFastEventMessage, isFastEventScope, isFunction, isPathMatched, isString, isSubsctiber };
@@ -274,6 +274,9 @@ type Overloads<T> = Unique<T extends {
274
274
  T
275
275
  ]>;
276
276
  type Dict<V = any> = Record<Exclude<string, number | symbol>, V>;
277
+ type Union<T> = T extends infer O ? {
278
+ [K in keyof O]: O[K];
279
+ } : never;
277
280
 
278
281
  type FastEventBusMessage<Events extends Record<string, any> = Record<string, any>, M = any> = FastEventEmitMessage<Events, M> & {
279
282
  from?: string;
@@ -311,7 +314,7 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
311
314
  anyListener: TypedFastEventAnyListener<Events, FinalMeta, Fallback<Context, typeof this>>;
312
315
  };
313
316
  prefix: string;
314
- emitter: FastEvent<Events>;
317
+ emitter: FastEvent<any>;
315
318
  constructor(options?: DeepPartial<FastEventScopeOptions<FinalMeta, Context>>);
316
319
  get context(): Fallback<Context, typeof this>;
317
320
  get options(): FastEventScopeOptions<FinalMeta, Context>;
@@ -359,9 +362,9 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
359
362
  emit(type: Types, directive: symbol): void;
360
363
  emit(type: string, directive: symbol): void;
361
364
  emit<R = any, T extends Types = Types>(type: T, payload?: Events[T], retain?: boolean): R[];
362
- emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? Events[Types] : any, retain?: boolean): R[];
365
+ emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? Events[T] : any, retain?: boolean): R[];
363
366
  emit<R = any>(type: Types, payload?: Events[Types], options?: FastEventListenerArgs<FinalMeta>): R[];
364
- emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? Events[Types] : any, options?: FastEventListenerArgs<FinalMeta>): R[];
367
+ emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? Events[T] : any, options?: FastEventListenerArgs<FinalMeta>): R[];
365
368
  emit<R = any>(message: FastEventEmitMessage<Events, FinalMeta>, options?: FastEventListenerArgs<FinalMeta>): R[];
366
369
  emit<R = any, T extends string = string>(message: FastEventEmitMessage<{
367
370
  [K in T]: K extends Types ? Events[K] : any;
@@ -428,7 +431,7 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
428
431
  * @template Meta - 事件元数据类型,默认为任意键值对对象
429
432
  * @template Types - 事件类型的键名类型,默认为Events的键名类型
430
433
  */
431
- declare class FastEvent<Events extends Record<string, any> = Record<string, any>, Meta extends Record<string, any> = Record<string, any>, Context = never, AllEvents extends Record<string, any> = Events & FastEvents, Types extends keyof AllEvents = Expand<Exclude<keyof (AllEvents), number | symbol>>> {
434
+ declare class FastEvent<Events extends Record<string, any> = Record<string, any>, Meta extends Record<string, any> = Record<string, any>, Context = never, AllEvents extends Record<string, any> = Expand<Events & FastEvents>, Types extends keyof AllEvents = Expand<Exclude<keyof AllEvents, number | symbol>>> {
432
435
  __FastEvent__: boolean;
433
436
  /** 事件监听器树结构,存储所有注册的事件监听器 */
434
437
  listeners: FastListeners;
@@ -750,13 +753,13 @@ declare class FastEvent<Events extends Record<string, any> = Record<string, any>
750
753
  emit<T extends Types = Types>(type: T, directive: symbol): any[];
751
754
  emit(type: string, directive: symbol): any[];
752
755
  emit<R = any, T extends Types = Types>(type: T, payload?: AllEvents[T], retain?: boolean): R[];
753
- emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? AllEvents[Types] : any, retain?: boolean): R[];
756
+ emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? AllEvents[T] : any, retain?: boolean): R[];
754
757
  emit<R = any, T extends string = string>(message: FastEventEmitMessage<{
755
758
  [K in T]: K extends Types ? AllEvents[K] : any;
756
759
  }, Meta>, retain?: boolean): R[];
757
760
  emit<R = any>(message: FastEventEmitMessage<AllEvents, Meta>, retain?: boolean): R[];
758
761
  emit<R = any, T extends Types = Types>(type: T, payload?: AllEvents[T], options?: FastEventListenerArgs<Meta>): R[];
759
- emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? AllEvents[Types] : any, options?: FastEventListenerArgs<Meta>): R[];
762
+ emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? AllEvents[T] : any, options?: FastEventListenerArgs<Meta>): R[];
760
763
  emit<R = any, T extends string = string>(message: FastEventEmitMessage<{
761
764
  [K in T]: K extends Types ? AllEvents[K] : any;
762
765
  }, Meta>, options?: FastEventListenerArgs<Meta>): R[];
@@ -1149,4 +1152,4 @@ declare function isClass(target: unknown): target is new (...args: any[]) => any
1149
1152
 
1150
1153
  declare function isFastEvent(target: any): target is FastEvent;
1151
1154
 
1152
- export { AbortError, BroadcastEvent, CancelError, type ChangeFieldType, type DeepPartial, type Dict, type Expand, type Fallback, FastEvent, FastEventBus, type FastEventBusEventTypes, type FastEventBusEvents, type FastEventBusMessage, FastEventBusNode, type FastEventBusNodeIds, type FastEventBusNodeOptions, type FastEventBusNodes, type FastEventBusOptions, FastEventDirectives, type FastEventEmitMessage, FastEventError, type FastEventListenOptions, type FastEventListener, type FastEventListenerArgs, type FastEventListeners, type FastEventMessage, type FastEventMessageExtends, type FastEventMeta, type FastEventOptions, FastEventScope, type FastEventScopeMeta, type FastEventScopeOptions, type FastEventSubscriber, type FastEvents, type FastListenerMeta, type FastListenerNode, type FastListeners, type Merge, NamespaceDelimiter, NodeDataEvent, type ObjectKeys, type OptionalItems, type Overloads, type OverrideOptions, type PickScopeEvents, QueueOverflowError, type RequiredItems, type ScopeEvents, TimeoutError, type TypedFastEventAnyListener, type TypedFastEventListener, type TypedFastEventMessage, type TypedFastEventMessageOptional, UnboundError, type Unique, __FastEventScope__, __FastEvent__, __expandable__, expandable, isClass, isExpandable, isFastEvent, isFastEventMessage, isFastEventScope, isFunction, isPathMatched, isString, isSubsctiber };
1155
+ export { AbortError, BroadcastEvent, CancelError, type ChangeFieldType, type DeepPartial, type Dict, type Expand, type Fallback, FastEvent, FastEventBus, type FastEventBusEventTypes, type FastEventBusEvents, type FastEventBusMessage, FastEventBusNode, type FastEventBusNodeIds, type FastEventBusNodeOptions, type FastEventBusNodes, type FastEventBusOptions, FastEventDirectives, type FastEventEmitMessage, FastEventError, type FastEventListenOptions, type FastEventListener, type FastEventListenerArgs, type FastEventListeners, type FastEventMessage, type FastEventMessageExtends, type FastEventMeta, type FastEventOptions, FastEventScope, type FastEventScopeMeta, type FastEventScopeOptions, type FastEventSubscriber, type FastEvents, type FastListenerMeta, type FastListenerNode, type FastListeners, type Merge, NamespaceDelimiter, NodeDataEvent, type ObjectKeys, type OptionalItems, type Overloads, type OverrideOptions, type PickScopeEvents, QueueOverflowError, type RequiredItems, type ScopeEvents, TimeoutError, type TypedFastEventAnyListener, type TypedFastEventListener, type TypedFastEventMessage, type TypedFastEventMessageOptional, UnboundError, type Union, type Unique, __FastEventScope__, __FastEvent__, __expandable__, expandable, isClass, isExpandable, isFastEvent, isFastEventMessage, isFastEventScope, isFunction, isPathMatched, isString, isSubsctiber };