---
lang: en
title: 'API docs: context.asyncproxy'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.context.asyncproxy.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [AsyncProxy](./context.asyncproxy.md)

## AsyncProxy type

The proxy type for `T`<!-- -->. The return type for any method of `T` with original return type `R` becomes `ValueOrPromise<R>` if `R` does not extend `Promise`<!-- -->. Property types stay untouched.

<b>Signature:</b>

```typescript
export declare type AsyncProxy<T> = {
    [P in keyof T]: AsInterceptedFunction<T[P]>;
};
```

## Example


```ts
class MyController {
  name: string;

  greet(name: string): string {
    return `Hello, ${name}`;
  }

  async hello(name: string) {
    return `Hello, ${name}`;
  }
}

```
`AsyncProxy<MyController>` will be:

```ts
{
  name: string; // the same as MyController
  greet(name: string): ValueOrPromise<string>; // the return type becomes `ValueOrPromise<string>`
  hello(name: string): Promise<string>; // the same as MyController
}

```


