4 ms·
> It lacks access control for class properties/methods, I wouldn't call that powerful. You mean `private` and such ? Well JavaScript don't support taht either
by stymaar 10y ago
> It lacks access control for class properties/methods, I wouldn't call that powerful.
You mean `private` and such ? Well JavaScript don't support taht either yet, and flow is a type-system for JavaScript, it's not a new language on its own.
About the «powerful» word: Flow has had an algebraic data type (ADT) from the beginning, the kind of type system you'd find in functional programming languages, whereas TypeScript has and Object-Oriented type-system (à la Java or C#). ADT are usually considered «more powerful» since it offers more ways to write logical invariants in your code. The recent versions of TypeScript tries to retro-fit some features of ADTs into it, like non-nullable types or sum types, but it's a bit hacky IHMO[1].
[1]: https://www.typescriptlang.org/docs/handbook/advanced-types.html#discriminated-unions https://www.typescriptlang.org/docs/handbook/advanced-types....
- addicted 10y agoTypescript has had Discriminated Unions as long as I can remember (pre 1.0). Why do you think they've been hacked in?