You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Explicit visibility declarations can make code more readable and accessible for those new to TS.
Other languages such as C# default to private, unlike TypeScript’s default of public. Members lacking a visibility declaration may be an indication of an accidental leak of class internals.
Is the above a risk for SE developers? What are our preferences?
The text was updated successfully, but these errors were encountered:
I lean towards always showing the public keyword (again, with the exception of the constructor). My argument here is that other languages have different implicit visibilities. My one example of this is Java, where the methods are considered package-visible (I'll admit my Java is rusty, so I don't know how true this is).
In scenarios like this, any dev knows exactly how visible a function or member is. Sure, it's tedious to write out the whole word, but if you ask me, it's always better to be explicit about stuff.
Using implicit public access modifiers seems to be the de-facto standard for Angular - members are assumed to be public unless otherwise specified:
However, the tslint "recommended" settings require explicit member access for everything (except constructors, I think?)
The rationale for tslint's setting is:
Is the above a risk for SE developers? What are our preferences?
The text was updated successfully, but these errors were encountered: