DEV Community

Cover image for TypeScript vs Flow

TypeScript vs Flow

stereobooster on October 18, 2018

TypeScript vs Flow This is not a strict comparison, more like a reflection. To me, Flow and TypeScript are same-ish, both not ideal yet ...
Collapse
 
antonk52 profile image
Anton Kastritskiy •

Thank you for the post. It was interesting to read. I didn't get the I heard that exact object types are coming to Flow part. Isn't $Exact<{}> or {||} is an exact object type or am I missing something? It would be fair to notice that flow is written in ocaml which works threeish times faster when analysing a large project.

For those who already use flow in a app with redux this lib can come in pretty handy
github.com/lttb/typed-actions

Collapse
 
stereobooster profile image
stereobooster •
Collapse
 
pndyjack profile image
pndyjack •

"It asked me to sort properties alphabetically. Seriously who has time for this?"

You can use prettier-tslint to auto-fix many tslint errors.

Collapse
 
markerikson profile image
Mark Erikson •

It's still an absurd thing to enforce as a compiler error, especially by default, and absolutely absurd for a tool based on Create-React-App.

Dan Abramov and I have both urged the author to change the default link setup (per create-react-app-ts #333 ). It looks like there's some open PRs to do that, but no recent progress. Very frustrating.

I actually just tried TS "for real" for the first time today, and I see some potential benefits to using it, but it's hard to recommend CRA-TS as a tool for a beginner with that ridiculously restrictive "lint" setup.

Collapse
 
pndyjack profile image
pndyjack •

Agreed, enforcing it as an error would be very frustrating especially for beginners.

Collapse
 
stereobooster profile image
stereobooster •

Can't wait to try this github.com/facebook/create-react-a...

Collapse
 
thorstenhirsch profile image
Thorsten Hirsch •

But can you write type-safe react routes with Flow? I don't think so. My vote goes to Typescript.

Collapse
 
stereobooster profile image
stereobooster • • Edited

Reminds me old joke: how I would prefer code snippet

1) github repository
2) gist
3) blogpost

...

997) scanned screenshot in an email
998) written with blue paint on a cow
999) as a YouTube video

Collapse
 
davidchase profile image
David Chase •

Nice write up :)

What about this "Don't get me started about ReasonML/BuckleScript" ?

Collapse
 
stereobooster profile image
stereobooster •

I like all ideas behind ML-family (OCaml, Elm etc), but the way it is currently done is not yet prefect. It is very promising, but requires a lot of work. This is short version

Collapse
 
fc250152 profile image
Nando •

I have some eggs. I have to get only their yolks for my recipe. I may get them by hand. Or I could use a tool that does the job. But in this latter case I have to watch it ... maybe it can destroy some egg! Boh? Finally I decide to use my hands. Got it?