---
lang: en
title: 'API docs: context.asyncproxy'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/context
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.

**Signature:**

```typescript
export type AsyncProxy<T> = {
    [P in keyof T]: AsInterceptedFunction<T[P]>;
};
```
**References:** [AsInterceptedFunction](./context.asinterceptedfunction.md)

## 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
}
```


