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
Improve support for @overload
tags
#2492
Comments
TypeDoc supports the TypeScript has an equivalent syntax which will produce the overloaded docs that you want: /**
* @example
* ```
* print("world");
* ```
* @param arg A string
*/
export function print(arg: string): void;
/**
* @example
* ```
* print(123);
* ```
* @param arg A number
*/
export function print(arg: number): void;
/**
* Prints the argument
* @example
* ```
* print(321);
* print("everyone");
* ```
*/
export function print(arg: string | number): void;
export function print(arg: string | number): void {
console.log("Hi " + arg);
} I still think including this in TypeDoc with a divergence from how TypeScript does things is a bad idea. |
Thanks for the clarification, it makes sense 👍 My use-case for this was to declare the overload for a function being re-exported as a But ... we could probably re-arrange our exports to make it easier for TypeDoc to understand. |
I believe if you add those comments on the signature, in the implementation of |
Search Terms
overload, overloading, overloads
Problem
With the introduction of "
@overload
Support in JSDoc" from TypeScript v5.0: https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#overload-support-in-jsdocWould it make sense to revisit the decision to "punt [support for overloads] to plugin-space": #2002 (comment)?
When documenting the overloads of a function
This is the documentation emitted:
I would love a way to declare the documentation of the two overloads.
Suggested Solution
I imagine that a function with overloads could have common documentation and the separate overloads could have sections under the "common" section.
The text was updated successfully, but these errors were encountered: