diff --git a/packages/lib/src/link/link.ts b/packages/lib/src/link/link.ts index 998e3a63..ebc5cecf 100644 --- a/packages/lib/src/link/link.ts +++ b/packages/lib/src/link/link.ts @@ -11,8 +11,8 @@ import type { User } from "../users"; import type { AddressType, JSONDeserialisable, MessageRoutable, MessageRequest, MessageEvent } from "../data"; export interface Request { - constructor: Partial>> & { - new (...args: any): Request, + constructor: Partial>> & { + new (...args: any): Req & Request, name: string, type: "request"; src: AddressType | readonly AddressType[]; @@ -25,8 +25,8 @@ export interface Request { export type RequestClass = Request["constructor"]; export interface Event { - constructor: Partial>> & { - new (...args: any): Event, + constructor: Partial>> & { + new (...args: any): T & Event, name: string, type: "event"; src: AddressType | readonly AddressType[]; diff --git a/packages/lib/src/subscriptions.ts b/packages/lib/src/subscriptions.ts index eb82e02e..ab7b4c7f 100644 --- a/packages/lib/src/subscriptions.ts +++ b/packages/lib/src/subscriptions.ts @@ -215,7 +215,7 @@ export class SubscriptionController { * Channels are an optional feature which can be implemented to only get notifications of reliant updates * Multiple handlers can be subscribed at the same time, on the same or different channels */ -export class EventSubscriber { +export class EventSubscriber, V=T> { _callbacks = new Array>(); _channelCallbacks = new Map>>(); lastResponse: Event | null = null; @@ -365,7 +365,7 @@ export class EventSubscriber { )); if (response.eventReplay) { - await this._handle(response.eventReplay); + await this._handle(response.eventReplay as any); } } }