New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not recognising documentation for class properties in JS files #1255
Comments
The cause of this is that we currently find members by looking at the AST nodes. We should instead be using the type checker. |
Is using the type checker something that might happen in the short term future? Might be naive (because I haven't been through the codebase) but what about just parsing property assignments for |
Unfortunately probably not very short term :/ Right now the whole converter structure is based on iterating over the nodes of a file. I'm guessing the type checker API wasn't nearly as complete when it was written so we couldn't just use it. Reworking the converters to use the type checker is something that needs to happen (maybe even for library mode to work, I've been running into a bunch of issues with the node based conversion) It should be possible to look inside the constructor as you suggest should fix this, PR welcome if you'd like to give it a try. The code should probably be around here - https://github.com/TypeStrong/typedoc/blob/master/src/lib/converter/nodes/constructor.ts#L26 |
In 0.20, we get the properties in a reasonable manner, by asking the type checker... but are still relying on nodes in order to find the comment, so they remain undocumented. Unfortunately, resolving this is... tricky. We can't use |
Hi, just wanted to ping how useful it would be if this could be addressed. I've been delving into using |
Well, turns out sometimes all that's necessary is a break of a few months... Literally a one line change to make this work. |
Brilliant, thanks! Incidentally I found an okay workaround for anyone waiting for the next version: /** class comment */
class Foo {
/**
* Property comment
* @prop bar
*/
/** constructor comment */
constructor() {
this.bar = 1
}
} The standalone property comments need to be inside the class but outside the constructor, and they need a |
It seems like Typedoc doesn't support the
@type
tag that TypeScript recommends using to add types to class properties in JavaScript projects.Example from the official handbook.
I have a project which documents properties this way extensively, but none of them end up in the generated documentation (regardless of visibility modifiers etc).
The constructor, accessors and all the methods are present in the generated docs, but no properties.
The text was updated successfully, but these errors were encountered: