Removing "private" modifier from types
See original GitHub issue[Feature suggestion] How about this (for Typescript 2.8+):
type Friend<T> = {
-private [P in keyof T]: T[P]
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:109
- Comments:56 (4 by maintainers)
Top Results From Across the Web
bypass / remove readonly modifier from private class properties
I want to override the readonly modifier on a class property. Unfortunately the properties are private and I can't use something like type...
Read more >Controlling Access to Members of a Class - Oracle Help Center
The private modifier specifies that the member can only be accessed in its own class. The protected modifier specifies that the member can...
Read more >Access Modifiers in Java - GeeksforGeeks
There are four types of access modifiers available in java: ... Private: The private access modifier is specified using the keyword private.
Read more >Code Syntax Style: Modifiers | JetBrains Rider Documentation
C# modifiers of types and type members can be written in any order. ... By default, JetBrains Rider suggests to use private and...
Read more >TypeScript Access Modifiers
The private modifier limits the visibility to the same-class only. When you add the private modifier to a property or method, you can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
Top Related Hashnode Post
No results found
Top GitHub Comments
Does this remove protected too ?😃
Perhaps there is also need for the opposite, adding public for all privates ?
I suppose it is very useful feature, because it allows to work better with decorators. For me it is quite common case when you create property decorator and need access to some private or protected property, but cannot get it due to current restrictions. That’s why you are forced to use
any
type in decorators, and it does not guarantee type-safety.The minimal example of this kind of decorators is following: