I'm working with the compiler API for a project and finding it difficult to get at the JSDoc associated with a node. When debugging, the node will have a jsDoc property, but I can't figure out the proper way to get TS to understand that the node has jsDoc or the proper way to retrieve the doc comment from that.
<ref *2> NodeObject {
pos: 173,
end: 243,
kind: 303,
id: 0,
flags: 524288,
modifierFlagsCache: 0,
transformFlags: 0,
parent: <ref *1> NodeObject {
},
original: undefined,
emitNode: undefined,
symbol: undefined,
localSymbol: undefined,
name: IdentifierObject {
},
initializer: <ref *3> NodeObject {
},
jsDoc: [
NodeObject {
pos: 175,
end: 203,
kind: 320,
id: 0,
flags: 17301504,
modifierFlagsCache: 0,
transformFlags: 0,
parent: [Circular *2],
original: undefined,
emitNode: undefined,
comment: 'JSDoc we want to keep',
tags: undefined
}
]
}```
I can't find a type predicate what will allow access to this property. I can just brute force it, but wanted to see if there was something more official. Thanks!