futurGH/ts-to-jsdoc

Missing JSDoc description when it contains @param itself

Closed this issue · 4 comments

Hey! I just tried to run ts-to-jsdoc on itself and came across this:

image

(it cuts off the description when encountering @param)

Another case:

image

Ooh, good catch! The compiler does seem to interpret those as actual JSDoc tags so I'll take that as user error on my part :^)

You mean it's a bug in ts-morph? TS compiler handles it correctly in a little test

Take a look at this. If you select the FunctionDeclaration and run node.jsDoc[0] in your browser console, you'll see that "test" is interpreted as the function's description, while everything following @param is interpreted as documenting the parameter.

In other words, it's not a bug — to the compiler, the function description is just "Generate".

Interesting, I only had a quick look at Intellisense before:

image

(it correctly attaches everything as a description only, no description for param)

Seems like it doesn't just rely on the TypeScript AST, at least a certain level of extra code - I couldn't figure out where exactly the extra handling happens 🤔