proposal-async-init
proposal-async-init copied to clipboard
await super() syntax
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).
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.