Skip to content

JsDoc is missing/duplicated in declarations for overloads declared in classes declared in functionsΒ #59397

Closed
@amerrit2

Description

@amerrit2

πŸ”Ž Search Terms

jsdoc overloads compiler declaration class function

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about overloads, classes, et al.

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.5.3#code/PQKhCgAIUgVALAlgZ0gEwPYGMCuBbAUwDsAXAQxMQyMhUgAcAnDegxgGwE9aaT4DIAOjSCSyKCGDgs7MslQAxDBkgBvKJE2gIm3TAQCA5srSRkiQ0Qo5GBDXqm7IAM2UAKAEZlGALjMlGRCJDAEo-ADcMRDQAbntIbXjoSAABNAImAjIsEgJTBDpzS2tbWlR0zOzctCTJeNcMNzD-QOC4pwbPbwB+P2QAoNC+geDIAB9ISOi1JN1bEhsaAHIkJfbdAF9IcA3wcETkg3RsfGJySmoeIRExMsgvGugpZxwiHKoaAFkyAGsCACFvE0Zk55otIDI5KhAYwQU5dAd4Xo4PxIMYMKYilYFrZZg48S53F5fC1Bs0prECYikck0hlbFgKHkUYULNibAI6BUGUzHjTkgTDkhUFiSpzUHgUOZRs5mHhIHwBMJROJ+U8CZ1mv1WoZ1kjOsTeqTglqRoZxpMoqZ1Gq5gQcctVgTdk5dhsgA

πŸ’» Code

/**
 * This documentation is properly in the .d.ts
 */
class Foo {
    /**
     * The good signature
     */
    foo(bar: string): void;
    /**
     * @depreacted This signature is depreacted
     */
    foo(): string;
    foo(bar?: string): string | void {
        return 'hi';
    } 
}

/**
 * The documentation in .d.ts is bad
 */
function MakeBar() {
    return class Bar {
        /**
         * The good signature
         */
        foo(bar: string): void;
        /**
         * @deprecated This signature is deprecated
         * 
         * This signature is missing from the .d.ts
         */
        foo(): string;
        foo(bar?: string): string | void {
            return 'hi'
        }
    }
}

πŸ™ Actual behavior

The jsdoc in the d.t.s file duplicates the jsdoc for the first signature found on all other overloaded signatures when a function returns a constructor. This behavior does not appear in normal class definitions.

πŸ™‚ Expected behavior

The JSDoc on each signature should match what's written for that signature in the .ts file.

Additional information about the issue

Intellisense that's picked up directly from the .ts file works fine - it understands the difference between the signatures, it's only the declaration file that's broken.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions