typedoc icon indicating copy to clipboard operation
typedoc copied to clipboard

Generic Type documentation

Open mudHOAX opened this issue 11 years ago • 3 comments

Is there a better way to comment on a generic type declaration?

/**
 * Some function that does something.
 * @param T The item type
 * @param a The item
 */
public someFunction<T>(a: T): void {
    ...
}

At the moment we are treating T as a @param, which seems to generate the correct documentation; it doesn't sit too well with me however lol.

mudHOAX avatar Feb 05 '15 11:02 mudHOAX

Yes, currently this is the only way to comment a type parameter. I have to admit this was a quick and dirty one. Any suggestions for a better tag? Maybe like this:

/**
 * Some function that does something.
 * @type T The item type
 * @param a The item
 */
public someFunction<T>(a: T): void {
    ...
}

sebastian-lenz avatar Feb 07 '15 16:02 sebastian-lenz

I wouldn't mind having the @type tag.

mudHOAX avatar Feb 09 '15 09:02 mudHOAX

Just asked Google, @type is used to annotate variables, see http://usejsdoc.org/tags-type.html. Maybe we should use another tag to avoid irritations. In this discussion they tend to use the form @param <T>. I tend to add support for

  • @param T
  • @param <T>
  • @typeparam T

sebastian-lenz avatar Feb 09 '15 13:02 sebastian-lenz