Commit 2e97c705 by Vladislav Lagunov

Замена Promise -> PromiseLike

parent 4ee41b3b
...@@ -132,7 +132,7 @@ export function fromCallback<L, R>(run: (cb: (x: Either<L, R>) => void) => void) ...@@ -132,7 +132,7 @@ export function fromCallback<L, R>(run: (cb: (x: Either<L, R>) => void) => void)
return Observable.create(observer => (run(x => (observer.next(x), observer.complete())), void 0)); return Observable.create(observer => (run(x => (observer.next(x), observer.complete())), void 0));
} }
export function promise<L, R>(func: (...args: Array<any>) => Promise<Either<L, R>>, ...args: Array<any>): Eff<L, R> { export function promise<L, R>(func: (...args: Array<any>) => PromiseLike<Either<L, R>>, ...args: Array<any>): Eff<L, R> {
return Observable.create(observer => { func.apply(undefined, args).then(x => (observer.next(x), observer.complete())).catch(e => (observer.error(e), observer.complete())); }) return Observable.create(observer => { func.apply(undefined, args).then(x => (observer.next(x), observer.complete())).catch(e => (observer.error(e), observer.complete())); })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment