question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RFC: Support for @typeparam or @template for documenting generic parameters

See original GitHub issue

In https://github.com/Microsoft/tsdoc/issues/8#issuecomment-424751850 @aciccarello wrote:

For a generic type definition, it can be helpful to document what the generic type is used for. Using @template was mentioned in some previous comments but I wonder if @typeparam would be better. Either way, I think this would be a good candidate for inclusion of the standard tags.

VS Code already has some support for @template and there has been a request for TypeDoc to support that as well (TypeStrong/typedoc#860). TypeDoc currently supports @typeparam T - Description and @param <T> - Description.

/**
 * Alias for array
 * 
 * @typeparam T - Type of objects the list contains
 */
type List<T> = Array<T>;

/**
 * Wrapper for an HTTP Response
 * @typeparam B - Response body
 * @param <H> - Headers
 */
interface HttpResponse<B, H> {
    body: B;
    headers: H;
    statusCode: number;
}

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:17
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

11reactions
rbucktoncommented, Dec 19, 2019

Also, the Closure Annotated JavaScript syntax is @template T (1, 2), which is already supported by TypeScript for hover/quick-info comments in both JavaScript and TypeScript files:

image

But @typeParam (or even @typeparam) is not currently supported:

image

4reactions
MartynasZilinskascommented, Mar 15, 2019

I used @template in previous codebases. I think the word came from c++.

@typeParam make more sense in TypeScript context.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TSDoc: @typeParam
Used to document a generic parameter. The @typeParam tag is followed by a parameter name, followed by a hyphen, followed by a description....
Read more >
How to document generic type parameters? - Stack Overflow
You can declare type parameters with the @template tag. ... are looking the TsDoc, you can use the https://tsdoc.org/pages/tags/typeparam/.
Read more >
vCard Format Specification RFC 6350 - IETF Datatracker
Document, Type, RFC - Proposed Standard (August 2011) Errata ... Registration Template for Parameters . ... Only the basic format is supported. 4.3.1....
Read more >
RFC 2426: vCard MIME Directory Profile
The profile definition is independent of any particular directory service or ... entry within the MIME Content-Type defined by the [MIME-DIR] document.
Read more >
1598-generic_associated_types - The Rust RFC Book
Type arguments can be used to encode other forms of higher kinded polymorphism using the "family" pattern. For example, Using the PointerFamily trait, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found