import { Future , MaybeFuture } from './future' ; export type BooleanLike = MaybeFuture < boolean > ; export class FutureBoolean extends Future < boolean > { not ( ) { return new FutureBoolean ( ( ) => ! this . resolve ( ) ) ; } and ( other ) { return new FutureBoolean ( ( ) => this . resolve ( ) && Future . resolve ( other ) ) ; } or ( other ) { return new FutureBoolean ( ( ) => this . resolve ( ) || Future . resolve ( other ) ) ; } thenElse < T , U > ( thenValue , elseValue ) { return this . map ( ( x ) => ( x ? Future . resolve ( thenValue ) : Future . resolve ( elseValue ) ) ) ; } } Future . prototype . equals = function ( other ) : FutureBoolean { return new FutureBoolean ( ( ) => this . resolve ( ) === Future . resolve ( other ) ) ; } ;