export class LazyPromise implements PromiseLike { private promise?: Promise constructor( private executor: ( resolve: (value: T) => void , reject: (reason: any) => void ) => void ) {} get then() { if (!this.promise) { this.promise = new Promise(this.executor) } return this.promise.then.bind(this.promise) } }