Creates a new Promise and returns it in an object, along with its resolve and reject functions.
An object with the properties promise, resolve, and reject.
promise
resolve
reject
const { promise, resolve, reject } = Promise.withResolvers<T>(); Copy
const { promise, resolve, reject } = Promise.withResolvers<T>();
Creates a new Promise and returns it in an object, along with its resolve and reject functions.