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

Make sure that private constructors are always emitted in declarations #58655

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Andarist
Copy link
Contributor

fixes #58653

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label May 24, 2024
@DanielRosenwasser
Copy link
Member

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 25, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
pack this ✅ Started ✅ Results

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 25, 2024

Hey @DanielRosenwasser, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/161945/artifacts?artifactName=tgz&fileId=A1FE5F0BC957FC27BF6981AB63F0061609C64F024F8F972CF0C2F9632E318E3F02&fileName=/typescript-5.5.0-insiders.20240525.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented May 25, 2024

It arguably has broken behavior but can you also add the following test too?

class C {
    /**
     * @private
     * @overload
     * @param x {string}
     * @param y {string}
     */

    /**
     * @private
     * @overload
     * @param x {number}
     * @param y {number}
     */

    /**
     * @private
     * @param {...any} args 
     */
    constructor(...args) {

    }
}

@Gerrit0
Copy link
Contributor

Gerrit0 commented May 25, 2024

It'd be kind of nice to emit constructors even if they're public if they have a documentation comment, presumably the user wrote things there for a reason, and it'd be nice for downstream users to see it

* @param x {string}
* @param y {string}
*/
constructor(x: string, y: string);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct because we shouldnt be emitting types for private - this could reference private type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is invalid but it's a different bug - this test case has been suggested by @DanielRosenwasser and I'm investigating now (separately) what can be done to fix this.

The problem is not about what gets emitted here but about the fact that it's not recognized as private at all. Notice how there is no error here: TS playground

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSDoc @private on constructor without parameters is omitted in declaration files
5 participants