NonPostableEvt<T> and StatefulReadonlyEvt<T> are interfaces implemented respectively by the classes Evt<T> and StatefulEvt<T>. They contains all the methods but the ones used to post events, namely: .post(), .postOnceHandled() and the .state setter for StatefulReadonlyEvt
import { Evt, NonPostableEvt } from "evt";
const evtText= new Evt<string>();
//Api to expose.
export const api:{ evtText: NonPostableEvt<string>; } = { evtText };
//evtText exposed by the api cannot be postedβ¦
api.evtText.post //<=== TS error
api.evtText.postOnceMatched //<===== TS error
//β¦but we can post internally.
evtText.post("good");
import { FactorizeEvt } from "evt";
FactorizeEvt<Evt<string> | Evt<number>> β Evt<string | number>
//...Work as well with StatefulEvt, NonPostable ect