In Typescript, is there a difference between return x and return await x?
Suppose we have:
async function func(): Promise<void> { }
async function option1(): Promise<void> {
return await func();
}
async function option2(): Promise<void> {
return func();
}
I know that when targeting ES5, option1() will require more code.
In ES2015 and ES2016 it will have an additional yield keyword.
In ES2017 - it will just appear as-is, with the additional await.
- Is there any logical difference between the two versions?
- Can they behave differently in some way when executed?
- Is there a performance difference in ES2015? And in ES2017?