Module

x/evt/lib/types/Operator.ts

­čĺžEventEmitter's typesafe replacement
Go to Latest
File

/** https://docs.evt.land/api/operator */export type Operator<T, U> = Operator.f╬╗<T, U> | ((data: U) => boolean) | //Filter (U extends T ? (data: T) => data is U : never) //Type guard ;
export namespace Operator {
export type f╬╗<T, U> = f╬╗.Stateless<T, U> | f╬╗.Stateful<T, U> ;
export namespace f╬╗ {
export type Stateless<T, U> = (data: T, registerSideEffect: (sideEffect: () => void) => void) => readonly [U] | null;
export type Stateful<T, U> = [ (data: T, prev: U, registerSideEffect: (sideEffect: () => void)=> void) => readonly [U] | null, U //Seed ];
}
export type Stateless<T, U> = f╬╗.Stateless<T, U> | ((data: U) => boolean) | (U extends T ? (data: T) => data is U : never) ;
}