Skip to content

tsc generate an invalid output for js files that contains private fields when use --allowJsΒ #43234

Closed
@ibado

Description

@ibado

Bug Report

πŸ”Ž Search Terms

private js

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

foobar.js
=====================================
class FooBar {

    #foo() {
        console.log("foo")
    }
     
    bar() {
        console.log("bar")
        this.#foo();
    }
}
=====================================
$ tsc --allowJs -> invalid output

πŸ™ Actual behavior

Produces an invalid output

πŸ™‚ Expected behavior

Produce a valid output

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions