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

@param names are not rendered #1410

Closed
mk010101 opened this issue Dec 4, 2020 · 9 comments
Closed

@param names are not rendered #1410

mk010101 opened this issue Dec 4, 2020 · 9 comments
Labels
bug Functionality does not match expectation

Comments

@mk010101
Copy link

mk010101 commented Dec 4, 2020

Search terms

@param hyphen

Expected Behavior

The name of the param should be visible next to the 'param' field. The @param block is followed by a parameter name and then a hyphen.

Actual Behavior

The generated document omits the actual param names and just lists the description.
Screen Shot 2020-12-04 at 13 53 11

Steps to reproduce the bug

/**
 * @param side1 - First (face) side
 * @param side2 - Second side
 * @param dir - Direction of rotation. @default 'true'
 */
interface FlipOptions  {
    side1: HTMLElement;
    side2: HTMLElement;
    dir?: -1 | 1;
    singleDir?: boolean;
    vertical?: boolean;
    lockPointer?: boolean;
}

Environment

  • Typedoc version: 0.20.0-beta.24
  • TypeScript version: 4.1.2
  • Node.js version: 12.7.0
  • OS: OSX
@mk010101 mk010101 added the bug Functionality does not match expectation label Dec 4, 2020
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Dec 5, 2020

This is due to the template partial for comment tags - it you to use @param tags for what they are meant to be used for, not for documenting properties. I'd accept a PR that rendered the name if present

https://github.com/TypeStrong/typedoc-default-themes/blob/7754c7df1d9280da3e90e4b500737484f979245f/src/default/partials/comment.hbs#L14-L17

@mk010101
Copy link
Author

mk010101 commented Dec 5, 2020

This is the output of the same from https://microsoft.github.io/tsdoc
Screen Shot 2020-12-05 at 23 29 33

As you can see, it works correctly.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Dec 7, 2020

TSDoc != TypeDoc. TypeDoc doesn't currently conform to the TSDoc standard, though support for it is planned.

That demo is particularly misleading because it doesn't parse the source code - it only grabs a comment and then renders it. I suspect that if you ran that code through api-extractor, it would complain about your use of @param

@Gerrit0 Gerrit0 changed the title 0.20.0-beta.24: @param names are not rendered @param names are not rendered Dec 28, 2020
@justinwilaby
Copy link

This defect also applies to the TypeScript binding syntax for member functions:

class MyClass {
/**
* Function that does stuff
* 
* @param param1 - The first param
* @param param2 - The second param
*/
protected boundFunction = (param1: string, param2: number): void {}

Is there another way to document this syntax?

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 25, 2021

I'm not sure what you mean there. This seems to work as expected.

image

If you aren't seeing this, please open a new issue.

@cefn
Copy link

cefn commented Jun 9, 2021

I encounter what I think is the same problem in the context of a function type definition.

/**
 * @param a The first number
 * @param b The second number
 */
export type MyFun = (a: number, b: number) => void;

...gets rendered like...

image

Note the elements inlined in the comment which are marked param and have lost the a and b names.

I am invoking the build command with no arguments...

npx typedoc --watch --out docs ./src/index.ts 

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jun 13, 2021

That's a different bug - #799.

@cefn
Copy link

cefn commented Jun 13, 2021

Thanks for your attention @Gerrit0 I've subscribed to that one.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Sep 6, 2021

v0.22.x, I'm not too happy with this... but if you are seeing param tags rendered, you are likely using them in an unsupported way in the first place, so will leave it at this.

image

@Gerrit0 Gerrit0 added this to To Do in Version 0.22 via automation Sep 6, 2021
@Gerrit0 Gerrit0 moved this from To Do to Done in Version 0.22 Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
No open projects
Development

No branches or pull requests

4 participants