> For the complete documentation index, see [llms.txt](https://soufatn.gitbook.io/rxjs-book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://soufatn.gitbook.io/rxjs-book/summary/observable/observable_instance_methods/topromise.md).

# toPromise

Converts an existing observable sequence to an ES6 Compatible Promise.

## Arguments

1. `promiseCtor` *(`Function`)*: The constructor of the promise. If not provided, it looks for it in Rx.config.Promise.

## Returns

*(`Promise`)*: An ES6 compatible promise with the last value from the observable sequence.

## Example

```javascript
var promise = Rx.Observable.return(42).toPromise(RSVP.Promise);

promise.then(console.log.bind(console));

// => 42
```

## Example with config

```javascript
Rx.config.Promise = RSVP.Promise;
var promise = Rx.Observable.return(42).toPromise();

promise.then(console.log.bind(console));

// => 42
```
