Skip to content

Provide a better error message when "async" is mistyped? #25429

Closed
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Search Terms

error message async function

Suggestion

When I mistype async as something like asdync, the error messages are quite unhelpful. It would be nice to have "did you mean async?" suggestions, as when we mistype a variable name. Perhaps if the edit distance from this particular keyword is small?

If this idea is a good one, it might make sense to expand it to public, protected, etc.

Use Cases

This is a common thing for me, sadly. I assume new users have this problem as well.

Examples

asdync foo() { }

class Foo {
    private asdync bar() { }
}

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript / JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. new expression-level syntax)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions