Skip to content

rename members to adopt private properties #46

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

Merged
merged 2 commits into from
Feb 26, 2024
Merged

Conversation

Eskibear
Copy link
Member

See #29
Use ECMAScript private for better guarantee of the property isolation.

private => remove "private" and prepend # .
public => remove "public" as it's the default.

@juniwang
Copy link
Contributor

juniwang commented Feb 4, 2024

Is this private property standard widely adopted by JS libraries? Do we know the usage of old version browsers that do not support it?

@Eskibear
Copy link
Member Author

Eskibear commented Feb 5, 2024

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_properties#browser_compatibility
It's supported by almost all popular browser/runtimes in 2021. So I don't worry about compatibility.

@Eskibear
Copy link
Member Author

Eskibear commented Feb 5, 2024

As for how widely adopted, as far as I can tell there is quite a portion from a yearly survey:
image

And some repos under Azure org are starting to adopt it after a quick search, e.g. https://github.com/Azure/cadl-ranch/blob/c611311c3d36a3048a3077137cbd4e6be762d034/packages/cadl-ranch-coverage-sdk/src/client.ts#L12

@Eskibear Eskibear merged commit 45c8266 into main Feb 26, 2024
@Eskibear Eskibear deleted the yanzh/private-props branch February 26, 2024 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants