Skip to content
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

fix: JSDoc comments do not automatically apply to overloads #1704

Open
sliekens opened this issue May 27, 2024 · 0 comments
Open

fix: JSDoc comments do not automatically apply to overloads #1704

sliekens opened this issue May 27, 2024 · 0 comments
Labels
status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature.

Comments

@sliekens
Copy link

sliekens commented May 27, 2024

Description

In the index.ts file (src/index.ts), only the first overload of each function was documented using JSDoc comments. The intention here seems to be that the same comment should be displayed for all overloads, but that is not how (most?) editors work.

For example, the @deprecated warning for plainToClass does not appear for the second and third overload.

Minimal code-snippet showcasing the problem

/**
* Converts class (constructor) object to plain (literal) object. Also works with arrays.
*
* @deprecated Function name changed, use the `instanceToPlain` method instead.
*/
export function classToPlain<T>(object: T, options?: ClassTransformOptions): Record<string, any>;
export function classToPlain<T>(object: T[], options?: ClassTransformOptions): Record<string, any>[];
export function classToPlain<T>(
object: T | T[],
options?: ClassTransformOptions
): Record<string, any> | Record<string, any>[] {
return classTransformer.instanceToPlain(object, options);
}

Expected behavior

Every function should be documented individually.

Actual behavior

Deprecated overloads are not displayed as such in editors.

@sliekens sliekens added status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature. labels May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature.
Development

No branches or pull requests

1 participant