-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
More did-you-mean errors on classes in plain JS #49827
Conversation
Classes - that are declared with class declarations or expressions, but not constructor functions - and which have nothing in their heritage clauses Now provide spelling suggestions on misspelled property accesses. Because of JS support for assignment-as-declaration, it's still easy to mistakenly declare a property with a typo and not get any suggestions.
@typescript-bot run dt |
Heya @sandersn, I've started to run the diff-based user code test suite on this PR at c850390. You can monitor the build here. Update: The results are in! |
@sandersn |
TODO: This should probably skip decorated classes too |
Since decorators can introduce arbitrary properties
@typescript-bot test top100 |
Heya @sandersn, I've started to run the diff-based top-repos suite on this PR at ce47269. You can monitor the build here. Update: The results are in! |
Heya @sandersn, I've started to run the diff-based user code test suite on this PR at ce47269. You can monitor the build here. Update: The results are in! |
I think this is ready to review, but unless I can think of a better way to test it, I don't want to put it in 5.2 beta; right now my testing plan is to have real people to use and complain if the errors are too much. Any other ideas? I guess I could artificially turn this on for more file types, but I don't know of any good source of code with typos in it. Maybe I could download random npm packages. |
@sandersn Here are the results of running the user test suite comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Something interesting changed - please have a look. Details
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems fairly conservative, and I can’t think of a great way to test it on real code, since typos tend to get fixed eventually.
@sandersn Here are the results of running the top-repos suite comparing Everything looks good! |
Yeah, I agree. I'll merge it when 5.3 development starts. |
Later: Or, it turns out, just before it ends. |
Classes
constructor functions
Now provide spelling suggestions on misspelled property accesses.
Because of JS support for assignment-as-declaration, it's still easy to mistakenly declare a property with a typo and not get any suggestions.
I'm not sure this is a great idea; I'm going to run user tests and see how they look.
Fixes #45479