Skip to content

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

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

Closed
amerrit2 opened this issue Jul 23, 2024 · 0 comments Β· Fixed by #59675
Labels
Bug A bug in TypeScript Help Wanted You can do this
Milestone

Comments

@amerrit2
Copy link

πŸ”Ž 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Help Wanted You can do this
Projects
None yet
2 participants