export interface Observable < T > { subscribe ( observer ) : void ; } export interface Observer < T > { onNext ( value ) : Promise < boolean > ; } export type Sequence < T > = T | Thenable < T > | Observable < T > ; export function isObservable < T > ( s ) { return ! ! ( ( s as Observable < T > ) . subscribe ) ; } export function isThenable < T > ( s ) { return ! ! ( ( s as Thenable < T > ) . then ) ; }