News for hackers. Stuff that matters.
Re:What's New in Create React App by oyvey on Friday May 19, 2017 @02:25AM (#14373399)
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.
Re:What's New in Create React App by tomduncalf on Friday May 19, 2017 @02:38AM (#14373436)
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
Re:What's New in Create React App by Vinnl on Friday May 19, 2017 @03:46AM (#14373654)
That's pretty sweet, especially because they do so without having to eject.

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

Re:What's New in Create React App by tomduncalf on Friday May 19, 2017 @03:52AM (#14373665)
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

Re:What's New in Create React App by Vinnl on Friday May 19, 2017 @04:45AM (#14373856)
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.
Re:What's New in Create React App by jimmcslim on Sunday May 21, 2017 @06:35AM (#14386627)
A link to your blog post would be great!
Re:What's New in Create React App by rpwverheij on Friday May 19, 2017 @05:51AM (#14374132)
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!
Re:What's New in Create React App by jmkni on Friday May 19, 2017 @09:25AM (#14375356)
So now we have competing official React starter kits?
Re:What's New in Create React App by slackingoff2017 on Friday May 19, 2017 @02:35AM (#14373426)
Typescript is the best thing to happen in JS land in years. It finally makes large applications possible without a large element of chaos.
Re:What's New in Create React App by ng12 on Friday May 19, 2017 @02:50AM (#14373467)
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.
Re:What's New in Create React App by n42 on Friday May 19, 2017 @02:53AM (#14373475)
TypeScript is now incremental in that way: https://blogs.msdn.microsoft.com/typescript/2017/04/27/annou...
Re:What's New in Create React App by bcherny on Friday May 19, 2017 @04:00AM (#14373691)
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.
Re:What's New in Create React App by ng12 on Friday May 19, 2017 @01:58PM (#14377967)
> 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.

Re:What's New in Create React App by bcherny on Friday May 19, 2017 @03:49PM (#14378833)
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.

Re:What's New in Create React App by ng12 on Friday May 19, 2017 @04:15PM (#14378993)
> 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.

Re:What's New in Create React App by bcherny on Friday May 19, 2017 @06:22PM (#14379772)
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.

Re:What's New in Create React App by davedx on Friday May 19, 2017 @02:32AM (#14373419)
Where are they pushing flow in create-react-app?
Re:What's New in Create React App by oyvey on Friday May 19, 2017 @03:42AM (#14373642)
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.

Re:What's New in Create React App by danabramov on Friday May 19, 2017 @06:51AM (#14374384)
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.
Re:What's New in Create React App by hzoo on Friday May 19, 2017 @08:27AM (#14374913)
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

Re:What's New in Create React App by Vinnl on Friday May 19, 2017 @10:47AM (#14376133)
That's awesome, I didn't even know that was a potentially viable route! Thanks for sharing :)
Re:What's New in Create React App by hzoo on Friday May 19, 2017 @03:57PM (#14378882)
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).
Re:What's New in Create React App by coldtea on Friday May 19, 2017 @03:31AM (#14373609)
>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?

Re:What's New in Create React App by oyvey on Friday May 19, 2017 @03:45AM (#14373651)
>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.

Re:What's New in Create React App by coldtea on Friday May 19, 2017 @09:53AM (#14375614)
>wrong. typescript is vastly more popular than flow.

Irrelevant, as both are still niche.

Re:What's New in Create React App by bcherny on Friday May 19, 2017 @03:56AM (#14373677)
According to npmjs.com:

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

- Flow: 889,612 downloads in the last month

Re:What's New in Create React App by exogen on Friday May 19, 2017 @04:24AM (#14373782)
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)
Re:What's New in Create React App by bcherny on Friday May 19, 2017 @03:50PM (#14378845)
Good catch. I also couldn't get numbers for `brew install flow` - are these tracked somewhere?
Re:What's New in Create React App by exogen on Friday May 19, 2017 @05:01PM (#14379324)
Re:What's New in Create React App by bcherny on Friday May 19, 2017 @06:23PM (#14379775)
Awesome. So we have 159,359 downloads via brew over the last year.
Re:What's New in Create React App by msmm on Friday May 19, 2017 @02:56AM (#14373490)
I wouldn't use M$ product. There is no guarantee that they either abandon it or start charging an arm and leg for use
Re:What's New in Create React App by tomduncalf on Friday May 19, 2017 @03:07AM (#14373531)
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.
Re:What's New in Create React App by msmm on Friday May 19, 2017 @06:40PM (#14379872)
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.
Re:What's New in Create React App by coldtea on Friday May 19, 2017 @03:32AM (#14373616)
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".