Effection Logo

interface Callable

thefrontside/effection

interface Callable<T extends Operation<unknown> | Promise<unknown> | unknown, TArgs extends unknown[] = []>

A uniform integration type representing anything that can be evaluated as a the parameter to https://effection-www-pggsafb7y58a.deno.dev/api/v4/call.

https://effection-www-pggsafb7y58a.deno.dev/api/v4/call converts a Callable into an Operation which can then be used anywhere within Effection.

APIs that accept Callable values allow end developers to pass simple functions without necessarily needing to know anything about Operations.

function hello(to: Callable<string>): Operation<string> {
  return function*() {
    return `hello ${yield* call(to)}`;
  }
}

await run(() => hello(() => "world!")); // => "hello world!"
await run(() => hello(async () => "world!")); // => "hello world!"
await run(() => hello(function*() { return "world!" })); "hello world!";

Type Parameters

T extends https://effection-www-pggsafb7y58a.deno.dev/api/v4/Operation&lt;unknown> | Promise<unknown> | unknown

TArgs extends unknown[] = []