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
I'm open to suggestions on the syntax; it doesn't have to be private set NAME: TYPE. TypeScript does not have a way to indicate that a field should be readonly at one access level but not another, but it does allow the getter and setter to have different access levels as in the above code.
The private field would have to have a synthesized name such that even if the class had an unrelated #x, this would not conflict.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
C# allows you to automatically synthesize a getter and a setter for a hidden field with different access levels:
class Foo has three declarations:
X
that returns the value of the hidden private fieldX
that modifies the value of the hidden fieldSwift has a different syntax for the same concept:
Civet could make use of the same thing:
I'm open to suggestions on the syntax; it doesn't have to be
private set NAME: TYPE
. TypeScript does not have a way to indicate that a field should bereadonly
at one access level but not another, but it does allow the getter and setter to have different access levels as in the above code.The private field would have to have a synthesized name such that even if the class had an unrelated
#x
, this would not conflict.Beta Was this translation helpful? Give feedback.
All reactions