Skip to content

private mode #56171

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

Closed
fsocietyCodeMaster opened this issue Oct 22, 2023 · 6 comments
Closed

private mode #56171

fsocietyCodeMaster opened this issue Oct 22, 2023 · 6 comments
Labels
Duplicate An existing issue was already created

Comments

@fsocietyCodeMaster
Copy link

🔎 Search Terms

private property in a class

🕗 Version & Regression Information

  • This is a crash
  • This changed between versions ______ and _______
  • This changed in commit or PR _______
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
  • I was unable to test this on prior versions because _______

⏯ Playground Link

No response

💻 Code

class Person {
private Name : string;
constructure(name : string){
this.Name = name
} }

🙁 Actual behavior

the problem is when we compile into javascript code in ES2022 we have # to make a property private and we cant get access to it
here in typescript even when we configure target to ES2022 , when we compile the above code in javascript file the privacy didnt applied and we can get access to the property and log it ,even the # doesnt appear

🙂 Expected behavior

in javascript we need to have the same result

Additional information about the issue

thanks you

@MartinJohns
Copy link
Contributor

This is working as intended. If you want ES2022 private properties you must use #. Properties marked as private will not be transformed to # properties.

@fsocietyCodeMaster
Copy link
Author

use # in type script so what is the point of using private key bro... nahh,

@MartinJohns
Copy link
Contributor

private has existed long long before #-properties. private is not going to be removed or transformed to #-properties (both would be massive breaking changes).

@fsocietyCodeMaster
Copy link
Author

so writing jacascript in typescript is better , its worthless to use private key waste of typing...
at least not in c++

@jcalz
Copy link
Contributor

jcalz commented Oct 22, 2023

Duplicates #31670

@fsocietyCodeMaster
Copy link
Author

Thanks bro

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Oct 23, 2023
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