Hacker News new | ask | show | jobs
by oyvey 3315 days ago
They should finally acknowledge the existence of typescript and not push everyone to their flow. Second of all: reduce the size of this starter kit. Other than that I really like the features.
6 comments

See https://news.ycombinator.com/item?id=14373433 - Microsoft have just released an official starter kit which uses create-react-app. Not tried it myself yet but it looks great and is well documented
That's pretty sweet, especially because they do so without having to eject.

Direct link: https://github.com/Microsoft/TypeScript-React-Starter

Yeah sorry, I linked to the post in the hope that this gains a bit of traction as really want people to be aware that getting started with TS and React is a whole lot easier now! I have a fairly popular blog post on the topic of setting up TS and React that I'll update to point to the Microsoft repo to help spread the word.

Here's the package that adds the TS functionality to create-react-app FYI: https://github.com/wmonk/create-react-app-typescript

No problem, I use TS+React too and definitely support this becoming less of an oddity. Luckily, it's moving in that direction already, with e.g. Jest being far easier to use with TypeScript since Jest 20.
A link to your blog post would be great!
ahh cool, didnt know, typescript is the main thing that would make me have to emmediatly eject since I use it for all my js projects these days, thanks!
So now we have competing official React starter kits?
Typescript is the best thing to happen in JS land in years. It finally makes large applications possible without a large element of chaos.
It doesn't push Flow, it just mentions it as an option. It's important to note that Flow is purely additive -- you can drop it in a project and get some use out of it. Typescript is not incremental in that way. You probably want to go all-in on it or not at all which is hard to allow for with a starter framework.
TypeScript is now incremental in that way: https://blogs.msdn.microsoft.com/typescript/2017/04/27/annou...
Have you actually used TypeScript? It's just as incremental as Flow, especially in newer versions. I converted a 100k line Coffee + ES6 codebase to TS with no issues.
> It's just as incremental as Flow

No, because TypeScript is a transpiler and Flow is a linter. You don't have to convert your codebase with Flow -- you can just run it on existing JS.

Flow is definitely not a Linter. It is a language, like TypeScript. It also has a typechecker, like TypeScript. Unlike TS, which bundles in its own compiler, Flow relies on projects like Babel to provide a compiler. In either case, compilation is mostly as simple as first linking modules, then typechecking, then stripping away types.

You can use TS on a JS codebase as well (with the --allowJs option), or you can leave JS files to a separate build step if you don't want type inference for them. I have used both approaches in the past.

> Flow is definitely not a Linter. It is a language, like TypeScript

This is absolutely untrue. Have you used Flow? It runs as a completely separate process -- you're literally running Flow as a command which typechecks/lints your code. It does not do any transpilation or modify your code in any way. The only caveat is the Flow type annotations which are A. optional and B. removed at compile time without doing any typechecking. Try it some time -- you can run Flow on existing JS code without modifying either your code or your build process in any way. It'll probably even find some bugs without you needing to add additional type information. This is fundamentally different from Typescript which goes hand-in-hand with a fully-featured transpiler.

To be clear, I use TypeScript and like it a lot -- but there seems to be a persistent perception that Flow and TS are two sides of the same coin. They are not and there are certainly some use cases where Flow fits better.

I have used Flow for a few projects.

I think we're saying the same thing. By "linter" I mean a program that only checks for stylistic and defined/undefined errors. To me, anything beyond that is a typechecker. Whereas TS bundles a typechecker with a transpiler, Flow keeps the 2 separate (you still need both if your program is written using Flow syntax).

You are using "linter" more broadly, which may be fair as well.

Additionally, both TS and Flow can be used on JS files with zero modification.

Where are they pushing flow in create-react-app?
https://github.com/facebookincubator/create-react-app/blob/m...

They are supporting flow but not TS.

Maybe writing "push" was a bit of an over statement from my side but for how well typescript plays with react and JSX and how much more popular it is compared to flow it should be either supported by them or flow shouldn't be. Currently they are discriminating in favor of flow. Which I mean they have 100% the right to do, its their product but as an end user I simply want to express my desire in that feature being first class.

The reality is not that we don’t want to support TS, but that its pipeline is significantly different from what we use at FB, so we neither have the expertise, nor can integrate the other tools we rely on. This might get better as AST interop between tooling improves.
Yep, and we (Babel) are trying to work with TS on integrating it into Babel similar to how flow works with Babel (parser support + a plugin/preset to strip types). Again, limited resources so if the community really wants it, we would appreciate help in reviewing PRs and testing!

https://github.com/babel/babylon/issues/320, https://github.com/babel/babylon/issues/523

That's awesome, I didn't even know that was a potentially viable route! Thanks for sharing :)
Yeah it's definetely a lot of work on both ends (also means would need to coordinate releases of both like we do with flow) but hopefully this helps the ecosystem that wants to use both (seems to be an increasingly higher number of people).
>They should finally acknowledge the existence of typescript and not push everyone to their flow.

They should support a niche third party competitor tool on their freely available and FOSS tooling?

>niche

wrong. typescript is vastly more popular than flow.

>competitor tool

hey if they got that thinking, its fine. its their product but from my user perspective I just want to let them know that I could really use some first class TS support.

>wrong. typescript is vastly more popular than flow.

Irrelevant, as both are still niche.

According to npmjs.com:

- TypeScript: 4,745,783 downloads in the last month

- Flow: 889,612 downloads in the last month

I'm guessing you're looking at `flow-bin`, which was not the official way to get the Flow binary for a long time (nor was installing it per-project), because the underlying executable isn't JavaScript. It would be more accurate to measure `babel-preset-flow`: https://www.npmjs.com/package/babel-preset-flow (2M in the last month)
Good catch. I also couldn't get numbers for `brew install flow` - are these tracked somewhere?
Awesome. So we have 159,359 downloads via brew over the last year.
I wouldn't use M$ product. There is no guarantee that they either abandon it or start charging an arm and leg for use
It's open source under the Apache Licence. Worst case scenario, the community would fork it and take over, but I don't think doing so would be remotely in Microsoft's interests. I genuinely believe the Microsoft of today is a totally different company in its attitude to open source software than it was even 10 years ago.
They are not. They sold me VS knowing well it will be obsolete in couple of months time and won't refund or discount upgrade. Absolutely vile company.
It's been close to 2 decades since the "M$" moniker had any relevance. This is not 1997 and we are not in the "browser wars".