4 ms·
As far as type systems/language features: TypeScript: - Structurally typed - Enum types - Mapped types - Abstract classes - Scoped class members (public,
by bcherny 10y ago
As far as type systems/language features:
TypeScript:
- Structurally typed
- Enum types
- Mapped types
- Abstract classes
- Scoped class members (public, private, protected)
- Namespaces
Flow:
- Nominally typed
- Covariance/contravariance annotations
- Supertype annotations (via $Supertype type)
- Subtype annotations (via $Subtype type)
- Arity annotations (via $Pred type)
- Subtraction types (via $Diff type)
- Opt-in 2-way type resolver (via * type)
- Refer to nested type (via $PropertyType type)
Otherwise, the two are remarkably similar.
I've been using TS for a few years, and Flow for a few months.
Please correct me if any of the above are wrong.
- andreypopp 10y agoIn Flow only classes are nominally typed. Objects and interfaces are typed structurally.
- pininja 10y agoThank you for the comparison. This basically matches my experience as well. Hoping your post gets up to the top.
- deleted 10y ago[deleted]