mirror of
https://github.com/robonen/tools.git
synced 2026-03-20 02:44:45 +00:00
fix(packages/stdlib): fix pubsub types
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import type { AnyFunction } from '../../../types';
|
||||
|
||||
export type Subscriber = AnyFunction;
|
||||
export type EventsRecord = Record<string | symbol, Subscriber>;
|
||||
|
||||
export type EventHandlerMap = Record<PropertyKey, Subscriber>;
|
||||
|
||||
/**
|
||||
* @name PubSub
|
||||
@@ -10,9 +11,9 @@ export type EventsRecord = Record<string | symbol, Subscriber>;
|
||||
*
|
||||
* @since 0.0.2
|
||||
*
|
||||
* @template {EventsRecord} Events
|
||||
* @template Events - Event map where all values are function types
|
||||
*/
|
||||
export class PubSub<Events extends EventsRecord> {
|
||||
export class PubSub<Events extends EventHandlerMap> {
|
||||
/**
|
||||
* Events map
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user