import { Task } from './task' ; declare module './task' { namespace Task { function fromPromise < TResult , EResult = any > ( promise ) ; } } Task . fromPromise = function < TResult , EResult = any > ( promise ) : Task < TResult , EResult > { return new Task ( ( outerResolve , outerReject ) => { promise . then ( outerResolve , err => outerReject ( err ) ) ; } ) ; } ;