interface Resolvable < T > { resolve : ( arg : T ) => void ; } /**
 * Creates a promise which can be resolved externally, useful for
 * coordinating async tests.
 */ export function resolvable < T > ( ) { let resolve ; return Object . assign ( new Promise < T > ( ( r ) => ( resolve = r ) ) , { resolve ( arg ) { return setTimeout ( ( ) => resolve ( arg ) , 0 ) ; } , } ) ; }