Consider this code:
function foo() {
return promiseFoo.then((res) => {
//...
//Construct a `promiseBar` object which is promise-like,
//but also has other uses.
//...
return promiseBar;
});
}
foo().then((res) => {
//Because `promiseBar` is promise-like, it was automatically resolved.
//So now, `res` is, for example, a primitive string instead of the
//original `promiseBar` object
})
Is there any way to prevent the automatic resolution of promise-like objects?