v3-callable.diff

on erock's pastes | raw

expires: 27 Feb, 2024

 1diff --git a/lib/call.ts b/lib/call.ts
 2index dfc9bf0..085e6d7 100644
 3--- a/lib/call.ts
 4+++ b/lib/call.ts
 5@@ -63,18 +63,16 @@ function isIterable<T>(it: unknown): it is Iterable<T> {
 6  * @param operator the operation, promise, async function, or generator funnction to call as part of this operation
 7  */
 8 export function call<T>(callable: () => Operation<T>): Operation<T>;
 9-export function call<T>(callable: () => Iterator<T>): Operation<T>;
10 export function call<T>(callable: () => Promise<T>): Operation<T>;
11 export function call<T>(callable: () => T): Operation<T>;
12 export function call<T>(callable: Operation<T>): Operation<T>;
13-export function call<T>(callable: Iterator<T>): Operation<T>;
14 export function call<T>(callable: Promise<T>): Operation<T>;
15 export function call<T>(callable: T): Operation<T>;
16 export function call<T>(callable: Callable<T>): Operation<T> {
17   return action(function* (resolve, reject) {
18     try {
19       if (typeof callable === "function") {
20-        let fn = callable as () => Operation<T> | Iterator<T> | Promise<T> | T;
21+        let fn = callable as () => Operation<T> | Promise<T> | T;
22         resolve(yield* toop(fn()));
23       } else {
24         resolve(yield* toop(callable));
25@@ -86,7 +84,7 @@ export function call<T>(callable: Callable<T>): Operation<T> {
26 }
27 
28 function toop<T>(
29-  op: Operation<T> | Iterator<T> | Promise<T> | T,
30+  op: Operation<T> | Promise<T> | T,
31 ): Operation<T> {
32   if (isPromise(op)) {
33     return expect(op);
34@@ -121,10 +119,8 @@ function expect<T>(promise: Promise<T>): Operation<T> {
35 
36 export type Callable<T> =
37   | Operation<T>
38-  | Iterator<T>
39   | Promise<T>
40   | T
41   | (() => Operation<T>)
42-  | (() => Iterator<T>)
43   | (() => Promise<T>)
44   | (() => T);