Async functions not friendly to promise extensions

medikoo at
Fri Apr 14 11:06:31 UTC 2017

> var k = (async function() {await window.setTimeout(1000); return

Assuming that setTmeout(1000) returns a promise, this code is equivalent to:

async function() {
    return setTimeout(1000).then(function () {
        return randomPromiseSubtype;

I definitely would not expect that k in such case resolves with promise of
type of  randomPromiseSubtype, same as you never expect that
`setTimeout(1000).then()`may resolve with different promise types.

However if it's:

async function() {
    return randomPromiseSubtypeTimeout(1000).then(function () {
        return whateverPromise;

It'll be great if k resolves with promise that shares the constructor with
promise returned by randomPromiseSubtypeTimeout(1000).then(...). That's my

View this message in context:
Sent from the Mozilla - ECMAScript 4 discussion mailing list archive at

More information about the es-discuss mailing list