Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / JavaScript

Promise.resolve — normalize a value to a promise

Promise.resolve(value) lets you treat an ordinary value, a promise, or a thenable as a promise. It can return an existing promise unchanged; resolved does not mean that the result is already available or that the operation will succeed.

Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support

Syntax

Promise.resolve(value)

Promise.resolve(value) is a static method for normalizing a value to a promise. Omitting the argument means undefined. When the method creates a new promise, it fulfills it with the argument if the argument is a primitive or if it is an object whose then property is read successfully and yields a non-callable value. If reading then throws, the new promise is rejected with that exception as its reason.

If p is a genuine promise, Promise.resolve(p) reads its constructor property. If the read returns Promise, the method returns exactly p. If the constructor getter throws, the method propagates the exception synchronously before creating a new promise, even if evaluating the argument p itself succeeds. The method creates a new promise if the argument is not a genuine promise or if reading its constructor returns a value other than Promise. A thenable, meaning an object with a callable then, is assimilated, and the result follows its settlement, including through further thenables. Rejection remains rejection; resolved does not mean fulfilled.

Callbacks passed to .then() run asynchronously, even when the promise is already fulfilled. The method does not catch errors from evaluating its argument: if fn() throws in Promise.resolve(fn()), the call throws synchronously. To defer the call and turn such an exception into a rejection, use Promise.resolve().then(() => fn()).

Examples

const p = Promise.resolve(7);
console.log(Promise.resolve(p) === p);

const thenable = { then(resolve) { resolve(42); } };
Promise.resolve(thenable).then(value => console.log(value));
console.log("sync");

Result

true
sync
42

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources