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

Private properties assigned in constructor disappear from object #60735

Closed
Hitulya opened this issue Dec 11, 2024 · 2 comments
Closed

Private properties assigned in constructor disappear from object #60735

Hitulya opened this issue Dec 11, 2024 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@Hitulya
Copy link

Hitulya commented Dec 11, 2024

πŸ”Ž Search Terms

constructor properties assignment

πŸ•— Version & Regression Information

5.7.2

⏯ Playground Link

No response

πŸ’» Code

Issue.ts

export class Issue {
  string2 = this.string1 + "b";
  constructor(private readonly string1 = "d") {}
}

main.ts

import { Issue } from "./Issue";

const _1 = new Issue();
console.log(_1.string2);

πŸ™ Actual behavior

Output is "undefinedb"

πŸ™‚ Expected behavior

Output should be "db"

Additional information about the issue

I used some class from my previous project, it didn't work correctly. After some investigation I came to this issue.

repo: https://github.com/Hitulya/ts-private-property-undefined-issue

@jcalz
Copy link
Contributor

jcalz commented Dec 11, 2024

Presumably a duplicate of #45995 and #55132, but the relevant config for the bug report seems to be hosted in your own repo instead of here in the bug report.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Dec 11, 2024
@typescript-bot
Copy link
Collaborator

This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants