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

Nested function's JSDoc lost after compilation when returned in an object #48495

Open
shortcuts opened this issue Mar 31, 2022 · 0 comments
Open
Labels
Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript
Milestone

Comments

@shortcuts
Copy link

Bug Report

Potentially related issues:

🔎 Search Terms

Nested function's JSDoc is lost after compilation when returned in an object, but works as expected when inlined in the return.

🕗 Version & Regression Information

  • Playground
    • All
  • Locally
    • 4.6.x (.2 and .3)
    • Nightly

⏯ Playground Link

Playground link with relevant code

💻 Code

Input

function x() {
    function u() {}

    /**
     * lol
     */
    function y() { }

    return {
        u,
        y,
        /**
         * lol2
         */
        z() { }
    }
}

Output .d.ts

declare function x(): {
    u: () => void;
    y: () => void;
    /**
     * lol2
     */
    z(): void;
};

🙁 Actual behavior

In the above example, the .d.ts files won't contain y's JSDoc, but only z's.

🙂 Expected behavior

Both JSDoc are preserved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants