-
Notifications
You must be signed in to change notification settings - Fork 13.3k
For const variable declaration, if type is left dangling, also suggest type #100146
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
Comments
cc @WaffleLapkin who knows how to do this since he worked on that |
@rustbot claim |
@Rageking8 what you've meant by a type that's left dangling? |
Basically just that the colon is included but no type is specified. |
This is because if we have colon, the parser will try to parse a type, then error will trigger. const a = 123
=>
const a: _ = 123 Then type checker will enrich the type messages. I'm thinking on the solution. |
@WaffleLapkin |
@chenyukang oh, I've had a fix too, oops 😅 I've opened a PR already: #100168, but feel free to open a PR as well, if you think your approach might be better. |
My fix is shorter, but seems a little bit hacky 😁 |
Given the following code:
The current output is:
Since the compiler suggests the type needed for the following:
The output ideally should also suggest the type if its left dangling.
The text was updated successfully, but these errors were encountered: