Skip to content

Suggestion regarding --noCustomAsyncPromise #7018

@yortus

Description

@yortus

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions