Fix resolution of properties from prototype assignment in JS#29302
Conversation
| >function() {} : typeof d | ||
|
|
||
| === tests/cases/conformance/salsa/b.js === | ||
| a.d.prototype = {}; |
There was a problem hiding this comment.
interesting...the change in type display indicates that we're now treating a.d as a class. I'm pretty sure that's because of the prototype assignment, where previously we only checked for members on the symbol.
(we print the type of 'a' as 'typeof a' because the expando assignments turn it into a namespace.)
| /** | ||
| * @type {MyClass} | ||
| ~~~~~~~~~~~~~~~ | ||
| !!! error TS8030: The type of a function declaration must match the function's signature. |
There was a problem hiding this comment.
I guess the second error goes away because getJSClassType doesn't have const valueType = getTypeOfSymbol() any more? Not entirely sure.
There was a problem hiding this comment.
Actually, it might be worthwhile to check whether we have any other error baselines that include the "JSDoc type circularly references itself".
There was a problem hiding this comment.
No other baselines had this error, and the original repro from the #27346 doesn't give this error anymore. I removed the circularity guard and no baselines changed, so I'll take that as part of this change too.
sandersn
left a comment
There was a problem hiding this comment.
Looks almost too good to be true! Please do check that we have test coverage of the circular jsdoc type error before merging though.
|
Just as a heads up, your commits don't seem to be associated with your GitHub account. While this isn't technically a problem, you might care if you want more appropriate attribution. You can either make sure your GitHub account is associated with the email address you're using for your commits, or rebase and amend your commits to fix the author name and email. |
* origin/master: (64 commits) Fix resolution of properties from prototype assignment in JS (microsoft#29302) Include all flow nodes made within `try` blocks as antecedents for `catch` or `finally` blocks (microsoft#29466) Don't treat interfaces as implementations Make the relationship between partial mapped types and the empty object not apply for subtype relationship (microsoft#29384) Add missing arity check on second inference pass (microsoft#29386) renames add missing type annotation PR feedback Illustrate a case that isn't handled correctly Add fourslash tests Consider JSX namespace imports when moving statements between files Fix gulp builds not building some targets Update user baselines (microsoft#29444) Add opt-in user preference for prefix and suffix text on renames (microsoft#29314) Fake up value declaration for synthetic jsx children symbol so they get excess property checked (microsoft#29359) Add regression test. (microsoft#29433) Elaborate jsx children elementwise (microsoft#29264) Add regression test PR feedback Fix trailing whitespace ...
* origin/master: (64 commits) Fix resolution of properties from prototype assignment in JS (microsoft#29302) Include all flow nodes made within `try` blocks as antecedents for `catch` or `finally` blocks (microsoft#29466) Don't treat interfaces as implementations Make the relationship between partial mapped types and the empty object not apply for subtype relationship (microsoft#29384) Add missing arity check on second inference pass (microsoft#29386) renames add missing type annotation PR feedback Illustrate a case that isn't handled correctly Add fourslash tests Consider JSX namespace imports when moving statements between files Fix gulp builds not building some targets Update user baselines (microsoft#29444) Add opt-in user preference for prefix and suffix text on renames (microsoft#29314) Fake up value declaration for synthetic jsx children symbol so they get excess property checked (microsoft#29359) Add regression test. (microsoft#29433) Elaborate jsx children elementwise (microsoft#29264) Add regression test PR feedback Fix trailing whitespace ...
Fixes #26885