-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Better checking of @param/@property tags #39487
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
Conversation
1. Use getWidenedTypeForVariableLikeDeclaration, instead of directly calling tryGetTypeFromEffectiveTypeNode. This requires some changes in the former function since it can't assume that the declaration has an initializer. 2. isOptional now calls isOptionalJSDocPropertyLikeTag. 3. isOptionalJSDocPropertyLikeTag now handles JSDocPropertyTag (previously it was named isOptionalJSDocParameterTag).
@typescript-bot perf test this |
Heya @sandersn, I've started to run the perf test suite on this PR at c11528a. You can monitor the build here. Update: The results are in! |
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.
Yeah, I agree that the re-sequencing looks nicer. The isInJSFile
check should be cheap since it's just a node flag check nowadays, anyway.
@sandersn Here they are:Comparison Report - master..39487
System
Hosts
Scenarios
|
Yep, no significant slowdown from the perf tests. |
* upstream/master: (75 commits) Insert auto-imports in sorted order (microsoft#39394) LEGO: check in for master to temporary branch. Better checking of @param/@Property tags (microsoft#39487) fix(25155): add space before optional parameters/properties (microsoft#38798) Add regression test for microsoft#38834 (microsoft#39479) Fixes searches for symbols exported using export * as (microsoft#39507) fix(39421): omit prefix text for rest binding element (microsoft#39433) fix(39440): show QF for abstract classes with methods which include 'this' parameter (microsoft#39465) Remove unnecessary assert (microsoft#39483) LEGO: check in for master to temporary branch. Update user baselines (microsoft#39220) Type `this` in more constructor functions (microsoft#39447) LEGO: check in for master to temporary branch. LEGO: check in for master to temporary branch. Properly handle rest parameters in function declarations with @type annotations (microsoft#39473) Ensure type/namespaceish statics are included in the list of namespace merge members (microsoft#38920) Fix getTypeAtLocation for dotted implements clauses (microsoft#39363) Add workflow_dispatch to our nightly publish script. (microsoft#39485) Fix crash in decorator metadata calculation when serializing template literal type nodes (microsoft#39481) Fix test semantic merge conflict between microsoft#39348 and microsoft#39130 (microsoft#39478) ... # Conflicts: # src/compiler/scanner.ts
getWidenedTypeForVariableLikeDeclaration now handles
@param
and@property
tags. I switched a couple of places to use type guards and added a call tohasExpressionInitializer
. Then, to avoid calling it twice, I moved a js-only check inside that block. I'm not certain it's the right thing -- the code is cleaner now, but I could have left it as-is and added casts instead. If performance is worse it's the first thing I'm going to try undoing.Fixes #39111