---
lang: en
title: 'API docs: context.asvalueorpromise'
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.asvalueorpromise.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [AsValueOrPromise](./context.asvalueorpromise.md)

## AsValueOrPromise type

Create the Promise type for `T`<!-- -->. If `T` extends `Promise`<!-- -->, the type is `T`<!-- -->, otherwise the type is `ValueOrPromise<T>`<!-- -->.

**Signature:**

```typescript
export type AsValueOrPromise<T> = T extends Promise<unknown> ? T : ValueOrPromise<T>;
```
**References:** [ValueOrPromise](./context.valueorpromise.md)


