Private Object Properties Using Flow’s Opaque Type Aliases
Historical
This post announced private object properties using opaque types when it was introduced. For current syntax and behavior, see the Opaque Types documentation.
In the last few weeks, a proposal for private class fields in Javascript reached stage 3. This is going to be a great way to hide implementation details away from users of your classes. However, locking yourself in to an OOP style of programming is not always ideal if you prefer a more functional style. Let’s talk about how you can use Flow’s opaque type aliases to get private properties on any object type.