-
-
Notifications
You must be signed in to change notification settings - Fork 290
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
Prefer real private fields over public/private #644
Labels
Comments
sindresorhus
changed the title
prefer real private fields over public/private
Prefer real private fields over public/private
Jan 9, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Javascript has private class fields now... and compilers are able to downgrade it to using
WeakMap
if necessary.I think public/private should be discouraged over the native approach. typescripts private keyword is only soft private and don't really protect anything. another thing is that compilers can mangle those hard private
#
names into 1-2 letter words when minifyinganother thing could be to discourage class fields that starts with
_
and warn/suggest to use#
instead (for both js and ts)...anything that have the keyword
public
is just bloated annotation, it's really just more simpler than that, everything that isn't private is public, why be so explicit?The text was updated successfully, but these errors were encountered: