Skip to content

regression: Private fields appear in type literal in declarations (5.9)Β #62153

Closed

Description

πŸ”Ž Search Terms

private declaration

πŸ•— Version & Regression Information

  • This changed between versions 5.8 and 5.9

⏯ Playground Link

Playground Link

πŸ’» Code

export const ClassExpression = class {
    #context = 0
};

πŸ™ Actual behavior

Declaration file contains invalid syntax

export declare const ClassExpression: {
    new (): {
        #context: number;
    };
};

πŸ™‚ Expected behavior

5.8 output is also incorrect but at least syntactically valid

export declare const ClassExpression: {
    new (): {
        "__#1@#context": number;
    };
};

Additional information about the issue

No response

Activity

  1. changed the title [-]regression: Private fields appear in type literal in declarations[/-] [+]regression: Private fields appear in type literal in declarations (5.9)[/+] on Jul 31, 2025
  2. jakebailey commented on Jul 31, 2025

    @jakebailey
    Member
  3. weswigham commented on Jul 31, 2025

    @weswigham
    Member

    I imagine expandable hover fixed printback of private props to be actual private props and not internal symbol names, so they could be displayed in the expansion. Really, this should be an error during declaration emit, like the private case is.

  4. locked as resolved and limited conversation to collaborators on Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions