Typedoc: Documenting callbacks using type aliases generates parameter documentation twice

Created on 17 Jun 2018  路  1Comment  路  Source: TypeStrong/typedoc

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.

bug

Most helpful comment

@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

>All comments

@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
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Rycochet picture Rycochet  路  4Comments

lsagetlethias picture lsagetlethias  路  3Comments

cfischer picture cfischer  路  4Comments

atomsoftwarestudios picture atomsoftwarestudios  路  4Comments

mcmath picture mcmath  路  3Comments