Hacker News new | past | comments | ask | show | jobs | submit login

> React integrates really well with flow[1] (which is not surprising because they're both developed at Facebook)

It can integrate just as well with TypeScript.

> flow's typesystem is more powerful (OCaml inspired)

It lacks access control for class properties/methods, I wouldn't call that powerful. https://flow.org/en/docs/types/classes/




> 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....


Typescript has had Discriminated Unions as long as I can remember (pre 1.0). Why do you think they've been hacked in?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: