> For the complete documentation index, see [llms.txt](https://bret-maxime.gitbook.io/reactjrx/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bret-maxime.gitbook.io/reactjrx/utils/javascript/ispromiselike.md).

# isPromiseLike

Assert whether a parameter is a promise like object by checking several parameters. Make sure your objects does not have .then properties if they are not to be promise as it's the minimum requirement of promises as stated in the specs <https://promisesaplus.com/#point-53>. This helper can be useful when you have a library that can take different type of input such as observable, promises or primitive values. It can help you make more flexible function and refine the treatment internally.

{% hint style="info" %}
This is a type guard function, the type of your promise will be correctly inferred.
{% endhint %}

### Usage

```typescript
import { isPromiseLike } from "reactjrx"

const maybePromise = Promise.resolve(3)

if (isPromiseLike(maybePromise)) {
    maybePromise.then(value => {
        // typed as `number`
    })
}
```

### Reference

```typescript
function isPromiseLike<T>(value: T): value is T & Promise<any>
```
