Module

x/evt/lib/types/helper/ToNonPostableEvt.ts

šŸ’§EventEmitter's typesafe replacement
Go to Latest
File

import type { StatefulReadonlyEvtLike, NonPostableEvtLike, NonPostableEvt, StatefulReadonlyEvt } from "../interfaces/index.ts";
type ToNonPostableEvtBase<E extends NonPostableEvt<any>> = E extends StatefulReadonlyEvtLike<infer U> ? StatefulReadonlyEvt<U> : E extends NonPostableEvtLike<infer U> ? NonPostableEvt<U> : never ;
type ToNonPostableEvtRecord<R extends { [key: string]: any; }> = { [P in keyof R]: R[P] extends NonPostableEvt<any> ? ToNonPostableEvtBase<R[P]> : R[P];};
/** https://docs.evt.land/api/helpertypes#tononpostableevt-less-than-e-greater-than */export type ToNonPostableEvt<E extends ({ [key: string]: any; } | NonPostableEvt<any>)> = E extends NonPostableEvt<any> ? ToNonPostableEvtBase<E> : ToNonPostableEvtRecord<E> ;