proposal-async-init icon indicating copy to clipboard operation
proposal-async-init copied to clipboard

await super() syntax

Open miyaokamarina opened this issue 5 years ago • 1 comments
trafficstars

Probably, super await() will work? This looks like existing for await syntax and, if I understand correctly, is not a valid syntax currently.

Also, despite the fact that await super() is a valid syntax, it will work exactly as expected when applied to an async superclass constructor call in an async subclass constructor (except the case when superclass is not async, but has Promise-like instance).

miyaokamarina avatar Feb 13 '20 19:02 miyaokamarina

super await() is invalid currently so it could be used.

Also, despite the fact that await super() is a valid syntax, it will work exactly as expected when applied to an async superclass constructor call in an async subclass constructor (except the case when superclass is not async, but has Promise-like instance).

Unfortunately this is likely not true, the this value of the constructor remains the Promise instance instead of the result of awaiting the Promise. That means that things like class fields are attached to the Promise instead of the asynchronous value they are wrapping.

bmeck avatar Feb 13 '20 19:02 bmeck