fix(valid-types
): fix parsing of expressions like @returns {@link SomeType}
#1382
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.
Fixed #1381.
I looked at a handful of ways to do this:
@es-joy/jsdoccoment
'sparseComment
function. Specifically I was hoping to wrap the type parsing logic. This seemed like the most elegant option but it fell flat. While this is technically possible I would have to hardcode thatgetTransformer
returns the type parser at index1
in order to wrap it and make it aware of this edge case.noTypes
set to include the tag. While possible it'd mean rerunning parsing from scratch. I'm okay with switching to this approach if you'd like.tag.type
totag.description
if it looks like a JSDoc tag. The type parser expects the type to be formatted as exactly{type}
and whitespace is preserved so the conversion back is currently lossless. However even if the parser were to change to parse out more forms (e.g.{type}
), I reason that it doesn't really matter becausedescription
isn't even checked in the rest ofvalid-types
.