import { Promise } from 'es6-promise' ; /**
 * A class that adds "intimate" methods to allow the promise to be resolved or
 * rejected outside of its own constructor callback. It is not recommended that
 * you actually call those methods if you're a user of this library.
 */ export interface ManipulablePromise < T > extends Promise < T > { private __resolve__ ? ( value ) : Promise < T > ; private __reject__ ? ( error ) : Promise < T > ; } const cleanAndSettle = < T > ( promise , settle , value ) : Promise < T > => { delete promise . __resolve__ ; delete promise . __reject__ ; settle ( value ) ; return promise ; } ; const createManipulablePromise = < T > ( ) : ManipulablePromise < T > => { let resolve , reject ; const promise = new Promise < T > ( ( res , rej ) : void => { resolve = res ; reject = rej ; } ) ; promise . __resolve__ = ( value ) : Promise < T > => cleanAndSettle ( promise , resolve , value ) ; promise . __reject__ = ( error ) : Promise < T > => cleanAndSettle ( promise , reject , error ) ; return promise ; } ; export default createManipulablePromise ;