Live data from Hacker News

If TypeScript is so great, how come all notable ReactJS projects use Babel?

discuss.reactjs.org

191–200 of 247 posts

Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?

#191
post #32

Earlier quoted context omitted.

WASM doesn't have DOM access or GC. It's not the answer.

Is that correct? WASM has no DOM access? (I'm asking, not advocating anything.) How does code that runs in a browser do UI I/O without DOM access? Is the intent that you go on writing all of your I/O and DOM-manipulating code with JavaScript and call WASM-implemented helper functions from JS code?

Inside a // tag.

Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?

#192

Earlier quoted context omitted.

I started off with C/C++, Java, then AS3 writing Flash games. Then js/jquery and I instantly hated it (js). There were just too many quirks, bizarre, unexpected behavior. Sure, I could learn it inside out and avoid these pitfalls, but why would I when there were better alternatives? I did use CoffeeScript after that, a beautiful little language, but only suitable for smallish projects. I need static typing for large…

Excellent, appreciate this thoughtful answer. So you mostly code games?

Mostly, but not just front-end. Back-end game engines, REST APIs, db, session, horizontal scaling, basically the whole architecture.

Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?

#193
post #168

Earlier quoted context omitted.

> I do TypeScript every day for work, and honestly I don't see the point of it. really? I'm assuming you never refactor anything.

Perhaps menu-driven refactoring is overrated? (much like IDE generated getter/setter code, which is solving the wrong problem)

What do you mean? It's the typescript compiler that catches your errors. The IDE stuff is nice to have, but it's not the main benefit typescript adds to refactoring. Typescript doesn't rely on an IDE.

Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?

#194
post #155

Earlier quoted context omitted.

Happy Dart programmer here. Great, easy to learn, productive language that runs on browser, server, mobile. I have no idea why Dart isn't used more.

Any tips on using Dart with mobile from Windows? I only need to target Android, not iOS. I haven't touched Dart for over a year, but the Flutter page seems like it is on HTML, not native, and it only specifies Linux or OS X dev machine.

Looks like Flutter dev for Windows isn't ready yet, but is planned. I believe Flutter is native, check out the system architecture:

https://docs.google.com/presentation/d/1cw7A4HbvM_Abv320rVgP...

Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?

#196

Earlier quoted context omitted.

> It would only increase the concept count in an educational setting where you want to only show the thing you're trying to explain. As someone who has written a long tutorial, this makes total sense. When I was first looking at the react ecosystem, it was very frustrating because of the high cost of picking pieces to work together. I really liked http://teropa.info/blog/2015/09/10/full-stack-redux-tutorial... becaus…

This is basically my frustration with the whole trend toward smaller pieces over big monoliths. I don't need a best-in-class every tiny little thing; I just want reasonable tools I can expect to work together well.

As someone who uses both stacks regularly, on different projects:

More people should consider using Angular 2 for some kinds of projects.

Now, I have professional projects in both Angular 2 and React/Redux ecosystems, and frankly I enjoy using React a lot more in projects where I can focus on the frontend. I moved some projects to isomorphic React (ie, render using React on backend) in Node.js and Rails apps, and thoroughly enjoyed that experience. I keep on top of Elm and omnext and so forth, and I have personal projects built with those, and I do experiments with completely unidirectional dataflow in Elm using an Elixir backend ...

However.

Twice recently, when I had a full-stack project with a relatively short timeline, I made a conscious decision to keep the frontend from getting too uppity and absorbing too much of my mental energy.

In those cases, I used Angular 2, generated from the ng2 CLI.

It's worked pretty well. Well, the first one had some dependency issues from time to time, which is understandable because of the beta -> rc1 -> rcX -> Angular2 release process that was happening.

Why ng2? Well ... not because I'm convinced that it's "the best" in any particular dimension. Its special sauce is supposed to be Zones, which make knowing when side-effects have occurred less something that we have to track and manage manually, but there's other work in that problem space!

I used it because it's an opinionated stack that already has the important pieces in place (router, DI, build/minify, type checking, components), and more importantly, because I can be fairly confident that another dev could get up to speed quickly due to decent docs and guides ... and it's less easy for someone to "paint themselves into a corner" by doing things really wrong.

Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?

#197

I've been using React + Redux + Typescript stack and I've been quite happy with it (It's hard for me to image how you could do big refactoring without TS). The fact that components props are verified by compiler instantly when I type is a big win. I believe with PropTypes you can't specifically describe what is the shape of your data, for example object with property of such name and the value of this property is obj…

> What I really miss is the ability to say that what is the return type of the method

Agreed! There's an open issue that addresses that scenario (and a ton of others):

https://github.com/Microsoft/TypeScript/issues/6606

Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?

#198
The ceaseless drumbeat of "why do I have to correct every breaking error in my code just to try it" just... Don't people realize how old and flawed this argument is?

And it's even stranger applied to Typescript, which is a fairly good implementation of a real-world gradual typing system.

Most modern type systems are quite good at giving you info about problems, blocking errors about the outright incorrect stuff, and otherwise get out of your way. Typescript is no different in this.

But many people (including the top reply) argue like secretly it's 2007 and we're talking about inscrutable C++ compiler errors from the last generation g++ compiler. We're not. Typescript is not only fast and friendly, but it's a heck of a lot more "batteries included" than Babel.

The funniest part is that ultimately flow desires to asymptotically approach what TypeScript already (for the most part) _is_ today.

Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?

#199
post #168

I do TypeScript every day for work, and honestly I don't see the point of it. I'm also of the opinion that the iterator pattern nonsense has ruined generated code quality for ES6 transpilers, and that ES5 getters and setters have made it considerably harder for JS engines to do high level optimizations (dead store elimination, invariant hoisting, load merging, etc.). The sky is falling. Anyway, you're not going to di…

> I do TypeScript every day for work, and honestly I don't see the point of it. really? I'm assuming you never refactor anything.

Assuming things about people from internet comments is usually rude, but I agree. From my experience a lot of the people that don't "get the point" of TypeScript or Flow haven't worked in largue applications that needed maintaining. I'm sure there are good arguments against them for large applications, but I'd need to hear them from people who've maintained (not just written!) a lot of large JavaScript applications. Your average React or Angular frontend probably doesn't count.

Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?

#200
post #79

Earlier quoted context omitted.

I can't find in the documentation, does the `pub build` tool do code splitting? I can't use a language without this.

Sorry for my ignorance, but does that amount to loading a library on demand? If so, yes, Dart can do this: import 'package:deferred/hello.dart' deferred as hello; // When you need the library, invoke loadLibrary() using the library’s identifier. greet() async { await hello.loadLibrary(); hello.printGreeting(); }

Also worth pointing out that Dart can do tree shaking at compile time, to eliminate library code that is never called
Post reply on HN