Provide a modifier to allow classes to protect property state while allowing mutations/changes within the class #39461
Labels
Declined
The issue was declined as something which matches the TypeScript vision
Suggestion
An idea for TypeScript
Search Terms
"modify readonly for internal classes" - leads to "as any" hack (Goal is to create convinience)
"protected" search - can only be read by derived classes
Suggestion
I find myself looking to complex solutions or longer code to protect state. I'm hoping typescript can be used to reduce code and protect state away from runtime through a public readonly modifier that has write access for internal methods of a class.
Use Cases
I'm hoping to save runtime through typing state protection and avoid extra code such as getters and frameworks that use runtime to manage state.
Examples
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: