Open abirmingham opened 4 years ago
Hey Alex!
I didn't look into this yet, but I think the reason this is happening is because this tag is a JSDocTemplateTag
:
And that node hasn't been wrapped yet (see here under "not exist").
Thanks for reporting and providing the simple reproduction. I'll look into implementing this soon.
@dsherret thanks for the quick reply! That does make sense.
Looking at wrapped-nodes.md
, it looks like there might be more cases of this than JSDocTemplateTag
, e.g. JSDocAuthorTag
. Thinking out loud here, but I wonder if JSDoc.getTags()
return type should become a union that includes the unwrapped nodes? Perhaps a union type wouldn't provide the optimal ergonomics, but it would be nice if the types somehow guaranteed that this issue would be caught at compile time rather than run time.
Describe the bug typescript version: 3.7.4 ts-morph version: 6.0.2
Here's an odd one! I am unable to call
getTagName()
on JSDoc tags if they are@template
tags. Oddly, I have a number of other tag names in my codebase, several of which are nonstandard, and yet@template
is the only offender.To Reproduce
Expected behavior Console prints
@template
.Actual behavior
TypeError: tag.getTagName is not a function
In my case I am able to work around the issue, but it is a bit of a nuisance (and a curiosity!)