nestjs-typed-events
Version:
Typesafe NestJS event emitter module
14 lines (13 loc) • 556 B
TypeScript
import { Entry, EventSchema, Registry } from './types';
export declare class EventContractBuilder<R extends EventSchema, T extends Registry<R> = {}> {
private readonly jsonObject;
private constructor();
static create<K extends EventSchema>(): EventContractBuilder<K>;
build(): T;
required<K extends string, V extends R>(key: K, value: V): EventContractBuilder<R, T & {
[k in K]: Entry<V>;
}>;
optional<K extends string, V extends R>(key: K, value: V): EventContractBuilder<R, T & {
[k in K]: Entry<V>;
}>;
}