JSDoc:positional matching of destructured params#23307
Merged
sandersn merged 3 commits intoApr 10, 2018
Merged
Conversation
1. When looking up tags for a parameter whose name is a binding pattern, use the index of the parameter to get the type. 2. When reporting errors for `@param` tags with no matching parameter name, do not report the error for tags whose index in the `@param` tag list matches the index of a parameter whose name is a binding pattern.
Member
Author
|
Perf tests show everything about the same except Angular binding, which is slower. There's no change in the binder for this PR, so it makes me think the results for Angular when testing #18832 are not valid either. |
ghost
approved these changes
Apr 10, 2018
| } | ||
| } | ||
| // a binding pattern doesn't have a name, so it's not possible to match it a JSDoc parameter, which is identified by name | ||
| // return empty array for: incorrect binding patterns and JSDoc function syntax, which has un-named parameters |
There was a problem hiding this comment.
An "incorrect" binding pattern is one at an index i which is greater than the number of @param tags?
ghost
reviewed
Apr 10, 2018
| // and give a better error message when the host function mentions `arguments` | ||
| // but the tag doesn't have an array type | ||
| if (decl) { | ||
| const i = getJSDocTags(decl).filter(isJSDocParameterTag).indexOf(node); |
There was a problem hiding this comment.
Maybe getParameterSymbolFromJSDoc should work for binding patterns too?
Member
Author
There was a problem hiding this comment.
There's no symbol on a binding pattern, though, so without adding something in the binder there's no benefit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@paramtags with no matching parameter name, do not report the error for tags whose index in the@paramtag list matches the index of a parameter whose name is a binding pattern.Fixes #19645
This is a small-ish change while we figure out how to make #18832 not hurt performance in the common case of Typescript code or non-destructuring parameters.