1
0
mirror of https://github.com/robonen/tools.git synced 2026-03-20 10:54:44 +00:00

fix(packages/stdlib): fix pubsub types

This commit is contained in:
2025-05-11 15:36:26 +07:00
parent 40d8194134
commit f8b37cacd3

View File

@@ -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
*