Skip to content

Documenting callbacks using type aliases generates parameter documentation twice #799

@jameswilddev

Description

@jameswilddev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions