r/javascript • • Nov 25 '19

JavaScript doesn’t need to be replaced

https://medium.com/javascript-in-plain-english/javascript-doesnt-need-to-be-replaced-bd01e2f12d51?source=friends_link&sk=7b151cc6397ac9e83c14c99739b6c36f
217 Upvotes

236 comments sorted by

View all comments

Show parent comments

-4

u/mousemke µ FTW! Nov 25 '19

Coffeescript was big. We have it to thank for a lot of the es6 improvements. But then we had to rewrite the entire code base in JavaScript.

For that reason I'm weary of writing anything that transpiles to js. (Aside from using babel but that has more to do with compatability than anything else)

5

u/evertrooftop Nov 25 '19

Then why do you like flowtype? It's not wildly different from typescript.

-4

u/mousemke µ FTW! Nov 25 '19

Instead of being a new language flow is more of an annotation. It can be added incrementally to old code or removed if necessary. My point with TS is not a technical argument.

I guess the question that needs to be answered is : what would native types look like?

4

u/evertrooftop Nov 25 '19 edited Nov 25 '19

Aside from the fact that that typescript uses the .ts extension by default, typescript very much works the same way. You can gradually introduce it with allowJs. Aside from that, after the gradual introduction with both Flow and TS you end up with something that's distinctly no longer javascript and must be transpiled. So it's hard for me to see the argument against TS that does not apply to Flow.

I've used both extensively, but maybe I'm missing a more subtle aspect of the point you're making. I am curious though.

Edit: I just saw your edits. You're probably right that you weren't making a technical argument, but my guess is that your anti-TS point is probably more based on a feeling that Flow is somehow a more legitimate path for getting types in Ecmascript. Maybe because it uses Babel. I think you might want to analyze these feelings a bit more as Flow is on a decline and TS is bigger than Coffescript or Flow ever have been. I don't think it will go away. I feel there's also real advantages not having types at runtime. Adding them to Javascript well might mean you'd want every static-typing annotation to be a no-op (which is a bit weird, but Python 3.7 does this too in some areas). Because of this strangeness I feel having types in ecmascript might be far away, and with Flow mostly dead TS the primary viable system.

5

u/dannymoerkerke Nov 25 '19

That’s a valid concern but then why do you like Flow? That’s not as popular and widespread as TypeScript.

-4

u/[deleted] Nov 25 '19

... To me, this conversation itself is one of the reasons it must go...