6 ms·
Have you spent any real time with Flow? As I’m starting to get into the modern front end world… I do want the safety of a stronger type system but it doesn’t l
by MBCook 8y ago
Have you spent any real time with Flow?
As I’m starting to get into the modern front end world… I do want the safety of a stronger type system but it doesn’t look like the React ecosystem has really decided which way to go.
TypeScript is popular. But flow was developed by Facebook and so it’s obviously heavily used by some of the top people.
I’ve only been reading about them, I haven’t chosen to use one yet. But I’ve been leaning on flow since it’s developed by the React team at Facebook.
- _frog 8y agoFrom my personal experience, Flow prioritises soundness in its type system, and thus can catch some bugs that TS won’t, but the TS tooling and editor support is drastically better than Flow’s. Edit: oh and it’s worth noting that I’ve had much more luck finding TS definitions for third party packages than I have with Flow.
- MBCook 8y agoCould you expand some more on the tooling/editor support? I’ve only done a cursory look. My editor (IntelliJ) supports both to some level. Webpack/Babel do too. I’m very new to writing React and modern front end JS so it’s quite possible there are things that I should be looking out for that I don’t even know about.
- nojvek 8y agoTypescript compiler architecture is quite different to flows. Typescript was written from the get go to provide really fast and accurate intellisense to IDEs. The newer refactoring powers are super nice too. Most ides just ask typescripts language service “hey, my user’s cursor is here, what should I show for code completion?” I think that’s what differentiates TS from flow. Typescript thought about the whole developers workflow while flow is just a compile time typechecker.
- alangpierce 8y agoTo Flow's credit, their language server does provide IDE features: https://github.com/flowtype/flow-language-server#supported-features https://github.com/flowtype/flow-language-server#supported-f... I still have found TypeScript to be an overall more pleasant developer experience, though.
- nojvek 8y agoThat’s awesome, I didn’t know that.
- Bahamut 8y agoAt this point, I think Flow clearly has a minority mindshare & is looked at more skeptically all around the JS ecosystem, and maybe even the React ecosystem based on what I see talked around. TS does a much better job integrating with existing JS and is much more practical about incremental updates whereas Flow bleeds all too easily into needing to add typing to a significant amount of code in order to add a type. That's not to say that either TypeScript or Flow are perfect - they both are constraining with typing when it comes to composing functions last I checked.
- dvlsg 8y agoI didn't have too many problems with typescript and ramda. I occasionally have to explicitly send in types to the first function of a pipe, which is a little annoying, but for the most part it seems to just work for how I use it. What problems have you run into?
- leppr 8y agoHave a look at the typescript declaration for Node's util.promisify (sorry on mobile can't find it right now). It's something like 10 lines long and covers only a handful of cases. It's not something you'd want to find in the middle of your code, yet you may have to if you want to do generic/functional programming in TS.
- Devagamster 8y agoFor what it's worth typescript is developed by Microsoft. Doesn't get much bigger than that
- MBCook 8y agoI know, and that’s a definite plus. I don’t have to worry that it will go away or lose all the main contributors. But is not developed by the same developers/company as React. I will say given what TS is competing against the fact that it so well used is rather compelling. I know all of Angular is also written in TS. It’s clearly very heavily used.
- murukesh_s 8y agoReact can fade but JavaScript won't..(it could only evolve). outside react Typescript is the clear winner and even most of the react projects I am seeing is using Typescript. I would say Typescript is the clear winner. Also VSCode is now far popular than other editors which is developed by Microsoft as well..
- nojvek 8y agoAlso typescript and React go really really well because typescript can do tsx which is a strongly typed flavor of jsx. Being able to use good code completion when using other people’s components is a huge boon.
- pas 8y agoIsn't React in itself a view library? What's there to develop on it? I'm really interested in this, as I'm a happy Angular user. (I'm primarily a non-frontend dev/tech/ops, but I occasionally I do frontend development.) So every time I look at a React component/codebase I'm completely lost, and I'd like to understand why and what and how.)
- deleted 8y ago[deleted]
- eropple 8y agoI've spent time with Flow, and I like some aspects of it (the type system seems a little more expressive, at least in the ways I know how to bend it). But it seems like TypeScript has fairly soundly won, as far as the two of them go. I've moved to writing almost exclusively TypeScript and I really don't regret it.
- machiaweliczny 8y agoI worked with both. Without going into details - I recommend TS as it's better documented and easier to work with. With 3.0 they also improved error messages. EDIT: one thing I miss from flow is https://github.com/gcanti/babel-plugin-tcomb https://github.com/gcanti/babel-plugin-tcomb - it's quite handy to spot data errors (before you have big static coverage)
- Vinnl 8y agoAlthough it's clear that Facebook's libraries, among which React, favour Flow, there's strong community demand for TypeScript even around React. Thus, the type definitions that are available for React are excellent, Redux even includes its type definitions natively, and most of the large tools in the React ecosystem work pretty well with TypeScript. The main large project you're likely to use that does not really play well with TypeScript yet is create-react-app. There's a TypeScript fork [1] which works reasonably well, but "reasonable" is not really what you'd hope. That said, the strong community push means that they're at least considering it. [2] [1] https://github.com/wmonk/create-react-app-typescript https://github.com/wmonk/create-react-app-typescript [2] https://github.com/facebook/create-react-app/pull/2815 https://github.com/facebook/create-react-app/pull/2815
- Raphael 8y agoCreate React App is the first link that TS gives you in "getting started". Is there something wrong with it? https://github.com/Microsoft/TypeScript-React-Starter#typescript-react-starter https://github.com/Microsoft/TypeScript-React-Starter#typesc...
- pmoleri 8y agoCRA is a set of packages, among which the most important is react-scripts (contains all build and publish commands). For Typescript you use rect-scripts-ts, a fork that usually is some versions behind the main one. It does work fine, but sometimes you don't get some of the gooddies that you get in the latest js version.
- styfle 8y agoI agree, the TypeScript team loves React and one of the reasons I started using React was because JSX/TSX is one of the few ways to type check views. I have been maintaining some boilerplate to demonstrate TypeScript + React SSR that should point the reader in the right direction https://github.com/styfle/react-server-example-tsx https://github.com/styfle/react-server-example-tsx
- acemarke 8y ago
- ggregoire 8y agoI've reported 5 bugs about Flow and can list at least 10 other bugs reported by other people that I experience on a daily basis. Most of them have been upvoted by hundreds of people. Most of them have been opened 1 or 2 years ago. Most of them don't have a single reply from people working on Flow (or one of these: "yes I guess it's a valid point", "pull requests are welcome", "it's not a bug" , "we would have to rewrite a lot of stuff", without any follow-up). That's what really frustrates me about Flow after using it for many years. We shouldn't have to rewrite valid code, write unreadable workarounds or add // $FlowFixMe annotations to avoid Flow's issues. I lead a small team of junior developers to whom I presented Flow. We now use it everywhere. But they often experience difficulties when they try to type their code. When I see what blocks them, my answer is too often "oh yeah, it's a bug in Flow. There is an issue about it on GitHub opened in 2016". I'm right now waiting for this https://github.com/facebook/create-react-app/pull/4837 https://github.com/facebook/create-react-app/pull/4837 to be merged to move all my projects to TS. Edit: and I don't blame the devs working on Flow. I guess it's more a priority issue at Facebook. Or maybe they just gave up on the community support since TS is too ahead.