-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Description
The --noCustomAsyncPromise switch was just introduced #6967.
ES7 async functions cannot return custom promises, but their TypeScript counterparts can. This switch makes it so that TypeScript's non-compliant async function behaviour is the default, and anyone wanting to maintain ES-compliant code has to provide this switch.
Why not have an --allowCustomAsyncPromise instead? Then anybody can opt in to TypeScript's custom async function behaviour, but is made more aware they are doing something special/non-standard because they need to provide the flag.
The current polarity of the flag may encourage a great deal more inadvertent use of this non-standard behaviour, causing greater pain down the line when async functions gain better runtime support and adoption. I think it would be prudent to put the non-standard behaviour behind a flag, and make standard behaviour the default.