# Around

```ts
type Around = [K in keyof Api] : Api[K] extends (…args: infer TArgs) => infer TReturn ? Middleware<TArgs, TReturn> : Middleware<[], Api[K]>
```

The shape of middlewares can surround a particular {Api}

Members of an Api that are values are surrounded by no-arg functions.

### Examples
#### Example 1
```ts
import type { Operation } from "effection";

interface DatabaseApiShape {
  query(sql: string): Operation<{ id: number; title: string }[]>;
  close(): Operation<void>;
}

let around: Partial<Around<DatabaseApiShape>> = {
  *query(args, next) {
    let [sql] = args;
    if (sql.includes("select")) {
      console.log("read query");
    }
    return yield* next(...args);
  },
  *close(args, next) {
    console.log("closing db connection");
    return yield* next(...args);
  },
};
```
---


### Type Parameters
[Api](https://frontside.com/effection/api/v4/Api.md)

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