export class Deferred < T > extends Promise < T > { constructor ( ) { if ( arguments . length > 0 ) { super ( arguments [ 0 ] ) ; this . resolve = ( ) => { throw new Error ( 'Deferred.resolve is not callable' ) ; } ; this . reject = ( ) => { throw new Error ( 'Deferred.reject is not callable' ) ; } ; return ; } let _resolve ; let _reject ; super ( ( resolve , reject ) => { _resolve = resolve ; _reject = reject ; } ) ; this . resolve = _resolve ! ; this . reject = _reject ! ; } resolve ! : ( v : T | PromiseLike < T > ) => void ; reject ! : ( reason ? : unknown ) => void ; } export default Deferred ;