# withResolvers

```ts
function withResolvers<T>(description?: string): WithResolvers<T>
```

Create an [Operation](https://frontside.com/effection/api/v4-next/Operation.md) and two functions to resolve or reject
it, corresponding to the two parameters passed to the executor of
the [action](https://frontside.com/effection/api/v4-next/action.md) constructor. This is the Effection equivalent of
[Promise.withResolvers()]https:

### Examples
#### Example 1
```ts
import { once, spawn, withResolvers } from "effection";

// one may pass a type for any value (or nothing) to resolve
let ready = withResolvers<Event>();

yield* spawn(function* () {
  // do some work
  ready.resolve(yield* once(socket, "open"));
});

let event = yield* ready.operation;
console.log(event.type); // "open"
```

---
### Type Parameters
T


### Parameters


**description**<span class="inline-block bg-sky-100 rounded px-2 text-sm text-sky-900 mx-1">optional</span>: string
### Return Type


[WithResolvers](https://frontside.com/effection/api/v4-next/WithResolvers.md)&lt;T&gt;


an operation and its resolvers.

[View code](https://github.com/thefrontside/effection/tree/effection-v4.2.0/lib/with-resolvers.ts#L73)
