Skip to content
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

Nested parameter descriptions #497

Closed
jonchardy opened this issue May 10, 2017 · 6 comments
Closed

Nested parameter descriptions #497

jonchardy opened this issue May 10, 2017 · 6 comments
Labels
question Question about functionality

Comments

@jonchardy
Copy link
Contributor

TypeDoc doesn't seem to have a way to provide comments for nested parameters. Consider the following TypeScript method:

/**
 * Test method with object param
 * @param {Object} options
 */
public foo(options: { first: string, second: number, third: (a: number) => number }) {

}

TypeDoc generates something like this:
image

Ideally there would be a way to provide descriptions for all parts of the parameter (first, second, third, a, returned number) using some sort of syntax within the comment. As it stands, I suppose it's possible to provide some sort of long description for the options param which describes each component of it, but then it becomes messy having the descriptions separated from the type information.

@aciccarello
Copy link
Collaborator

@jonchardy The best way to document a parameter object like that would be to define an interface. That also allows you to to reuse the interface. Is there a particular reason why you wouldn't define the interface externally?

@jonchardy
Copy link
Contributor Author

Yea, that's probably a better option. Definitely more TypeScript-y.

@aciccarello
Copy link
Collaborator

@jonchardy I was just looking at one of the tests and it appears that you may be able document these as well.

/**
 * Test method with object param
 * @param options Describing the options param
 * @param options.first A description of the first property of the options param
 */
public foo(options: { first: string, second: number, third: (a: number) => number }) {

}

This matches how JSDoc handles @param. It should be added to the TypeDoc docs.

@StephanBijzitter
Copy link
Contributor

I'm a bit confused.

This issue is closed, but it's in a project with status "to do" and what I get today is even less than the screenshot in the opening post.
All I see is options: object.

What do I do?

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Dec 15, 2019

The project it is in is documentation - we need to create clearer documentation on how this feature works.

The options: object is another bug - #1103 provides a partial fix that has one fatal flaw, and it will be fixed with #801.

@StephanBijzitter
Copy link
Contributor

Ah, thanks! With the information in those issues I got it working indeed :-)
Not perfect, but I'm happy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question about functionality
Projects
No open projects
Development

No branches or pull requests

4 participants