TypeScript has a private modifier, which prevents code outside a class from accessing particular properties and methods. Something similar could be done in Flow.
The modifier is also a shortcut (sugar), as is the public modifier.
constructor( public x : string ) {}
// vs
constructor(x : string) { this.x = x; }
Flow also has own private fields with munge_underscores option.
class A {
_myPrivateMethod() {}
}
Also native private fields are partially implemented and will be ready soon.
This probably can be closed.
/cc @vkurchatkin
@vjpr flow already has partial support for private (#) properties.
@TrySound Does this include methods?
No, I misread that it's about methods.
Is there a way to designate private constructors? I have a class which should only be created via a static factory method.
Most helpful comment
Flow also has own private fields with
munge_underscoresoption.Also native private fields are partially implemented and will be ready soon.
This probably can be closed.
/cc @vkurchatkin