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

Documenting callbacks using type aliases generates parameter documentation twice #799

Closed
jameswilddev opened this issue Jun 17, 2018 · 1 comment · Fixed by redpeacock78/cie.js#6
Labels
bug Functionality does not match expectation

Comments

@jameswilddev
Copy link

Hello!

Starting out with documenting a TypeScript project and there are places where methods have callbacks I would like to document. To do this, I make a type alias and document that:

/**
 * Call to send a message over all open sessions, where "open" is taken to mean
 * that at least one message has been received and the session has not ended.
 * @param message The message to serialize and send.
 */
export type Broadcast = (
  message: Json
) => void

This, however, generates documentation which lists the parameters twice, once without names, and once without descriptions:

a

Adding type parameters causes them to be documented similarly:

/**
 * Call to send a message over all open sessions, where "open" is taken to mean
 * that at least one message has been received and the session has not ended.
 * @template TOutboundMessage The type of message which can be sent.
 * @param message The message to serialize and send.
 */
export type Broadcast<TOutboundMessage extends Json> = (
  message: TOutboundMessage
) => void

b

So my question here is: how should I be documenting callbacks? I found mention in #102 that this was possible, but the same problems I am seeing here seem to apply there too.

Thanks,
James.

@rhuitl
Copy link

rhuitl commented Oct 29, 2018

@jameswilddev, I had the same problem. Try to put the docs between the = and the method declaration, it worked for me:

export type Broadcast = 
/**
 * Call to send a message over all open sessions, where "open" is taken to mean
 * that at least one message has been received and the session has not ended.
 * @param message The message to serialize and send.
 */
(
  message: Json
) => void

@aciccarello aciccarello added bug Functionality does not match expectation Priority: 3 labels Oct 29, 2018
@Gerrit0 Gerrit0 added this to To do in Version 0.21 via automation Jun 15, 2021
@Gerrit0 Gerrit0 moved this from To do to Done in Version 0.21 Jun 15, 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

Successfully merging a pull request may close this issue.

4 participants