Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 tasks done
JoshuaKGoldberg opened this issue Jul 4, 2018 · 2 comments · Fixed by #43005
Closed
4 tasks done

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

JoshuaKGoldberg opened this issue Jul 4, 2018 · 2 comments · Fixed by #43005
Labels
Bug A bug in TypeScript Domain: Error Messages The issue relates to error messaging Help Wanted You can do this

Comments

@JoshuaKGoldberg
Copy link
Contributor

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)
@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Domain: Error Messages The issue relates to error messaging labels Jul 5, 2018
@RyanCavanaugh RyanCavanaugh added this to the Community milestone Jul 5, 2018
@bhushan-shah-dev
Copy link

I want to give this a go as my first PR, but would appreciate some direction.

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Jul 14, 2021

Thank you @JoshuaKGoldberg!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Error Messages The issue relates to error messaging Help Wanted You can do this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants