Skip to content

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

Open
@sliekens

Description

@sliekens

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triageIssues which needs to be reproduced to be verified report.type: fixIssues describing a broken feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions