private export const controlledPromise = < T > ( ) : [ Promise < T > , ( value ? : T ) => void ] => { let resolve ; const promise = new Promise < T > ( ( _resolve ) => { resolve = ( value ? ) => _resolve ( value ) ; } ) ; return [ promise , resolve ] ; } ;