> For the complete documentation index, see [llms.txt](https://docs.tsafe.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tsafe.dev/ispromiselike.md).

# isPromiseLike

With this function we can check if its argument is like a `Promise`. In other words, if its argument has a method that is named `then`.

## Quick example

```typescript
import { isPromiseLike } from "tsafe/isPromiseLike";

const simulateNetworkDelay = new Promise<void>(resolve =>
	setTimeout(resolve, 1000)
);

const result = isPromiseLike(simulateNetworkDelay);

//result === true;
```

## Complementary example

If we have an object that has a method named `then`:

```typescript
import { isPromiseLike } from "tsafe/isPromiseLike";

const objPromiseLike = {
	then: () => null,
	x: 3,
	y: 4,
};

const result = isPromiseLike(objPromiseLike);

//result === true;
```
