
TypeScript Seals My Penchant for JavaScript - labrador
https://www.cycligent.com/blog/typescript-seals-my-penchant-for-javascript/
======
edem
I simply don't understand how can someone like javascript (or anything derived
from it) when there are so many much better languages around. Can someone
state some advantages for web development for example compared to ruby,
python, or clojure? All I see is a slow tangled mess of dependencies and
broken libraries with a package manager which lets you change already released
modules and a language which is even more poorly designed than PHP. Is it just
because of node.js and the promise that you can use javascript from database
to frontend?

~~~
izolate
Best thing about JavaScript is the speed of development. Once you master it,
all other languages & ecosystems feel verbose, archaic.

Modern JS (ES2015+) combined with a code style (Standard, Airbnb) is
beautiful, sometimes more so than Python.

Bad modules isn't a problem inherent to JS. NPM has its faults, but the JS
community is the largest, and the fastest moving of all. Everything you need
already exists, and it's probably actively maintained, if not accessible for
you to submit a PR.

PHP? Lol, no. JS > PHP.

~~~
gjolund
"Best thing about JavaScript is the speed of development. Once you master it,
all other languages & ecosystems feel verbose, archaic."

That is pure opinion.

~~~
edem
This might be true for C++ or Java but definitely not for any LISP dialect.
Have you heard of the blub paradox?

------
smegel
The most underrated feature of TypeScript is not the language itself, but the
transpiler. With the flick of a switch you can support ES3, ES5 and in future
ES6 and beyond - without changing your code (not entirely true, but it is
possible to write code that transpiles well to all JS standards).

Decoupling your development from the shifting sands of JS support - across
multiple browsers and platforms - is a dream come true, and a good enough
reason alone to use TS.

~~~
wtbob
But if you're going to transpile, why not transpile from a real language, not
a Turing tarpit?

~~~
smegel
Well Google already did that with Java and GWT, but it never caught on.

I guess TS being a superset of JS itself might be an advantage...otherwise it
is still a new language designed for web browser programming unlike Java.

I suppose it is a fair question why they didn't just use C#.

~~~
_pmf_
> Well Google already did that with Java and GWT, but it never caught on.

ClojureScript uses the Closure(sic) compiler from GWT to compile Clojure/Java
to JavaScript (not that I defend this technological train wreck).

> I suppose it is a fair question why they didn't just use C#.

This would have been superb, but I think Microsoft wanted to show that they
"get" web developers; just mentioning C# causes the JS pundit get jittery
because someone wants to limit the amount of write-only code he is able to
spit out.

~~~
greendragon
What exactly don't you like about ClojureScript? The tooling may be kind of
weird (and I believe you're out of date) but once you're set up with figwheel
and something like om/reagent/re-frame you start approaching the bottom-up,
truly dynamic, interactive approach to building things. Every time I hear
stories of "we couldn't scale our JS until we switched to TS" it's always the
case of they were developing their JS in IDEs and structured similarly to a
Java application, but without having to declare types and having slightly
nicer data literals...

------
caub
I love JS/ES2016 how it is, I seriosuly don't see the advantage of typescript
except maybe for a gigantic application

~~~
WayneBro
> seriosuly

Well, if English were statically typed, the compiler would have caught your
spelling mistake before you submitted your comment.

Types are valuable for any size application. They bring order to a chaotic
world.

If you don't do static typing, you have to do a lot more unit testing. You
also have to type out a lot of code to convert your function arguments into
the types that you actually wanted. So, you're spending your time either way.
Specifying types up front takes way less time than writing unit tests or
converting arguments.

~~~
koolba
> Well, if English were statically typed, the compiler would have caught your
> spelling mistake before you submitted your comment.

Ha! I love seeing things like this on HN and think it's a perfect example to
illustrate the power of static typing. Kudos!

~~~
talmand
I fail to see what typing and a typo have to do with each other to make that
joke worthwhile.

~~~
koolba
> I fail to see what typing and a typo have to do with each other to make that
> joke worthwhile.

Well to be fair it's more about static analysis vs catching typos though they
tend to go hand in hand. I suppose a more apt analogy would be transposing a
letter in the sentence where it was still spelled corrected but the part of
speech changed from a noun to a verb.

------
tkubacki
Since TS is superset of JS it has all it's flaws - we need different lang
compiled to JS (like Dart) not a mockup.

~~~
Klathmon
Just because a language has a feature does not mean you need to use it.

We use JavaScript, but in 90%+ of our codebase we use it without 'this',
without prototypes, without classes, and without other ugly parts.

~~~
aljones
You also don't use integers!

~~~
talmand
?

~~~
omni
JavaScript does not have an Integer primitive, it only has Number which is
floating point.
[http://www.w3schools.com/js/js_numbers.asp](http://www.w3schools.com/js/js_numbers.asp)

~~~
talmand
Why the downvotes? It answer the question.

As I'm not a deep coder, what are the advantages of having an integer type
versus a float type in the case of Javascript? Memory? Not having to use
Math.floor, Math.ceil, or Math.round in case of funky divisions? I've used
Javascript for years now without worrying over that particular detail.

------
xntrk
I took a look at Facebook's Flow type checker for Javascript seems like it
would really help with a lot of the authors complaints but would still get to
right mostly plain JS.

------
tribby
to save readers the time I've just wasted, here are the two sentences about
typescript in this sales pitch for cycligent.js:

"I am able to keep the freedom and expressiveness of JavaScript to which I
have become so accustomed while getting enterprise-level type checking and
refactoring capabilities. Declaration of objects and interfaces is a dream."

~~~
ilurkedhere
What on Earth is "enterprise-level type checking"?

~~~
skrebbel
Enterprise-level _capabilities_. I know the E-word is taboo here but aren't
you people exaggerating a but on the trolling?

~~~
coldtea
"Enterprise-level capabilities" doesn't mean anything still.

Google is bigger than most enterprises, and they don't use any "enterprisey"
stuff, not even in their Java.

~~~
GoToRO
Can people die from code written at Google?

~~~
coldtea
Sure. E.g. flaw in Gmail exposes identities of harassed persons to their ex-
spouses, etc.

------
colinmegill
Going ahead and linking to the website linked to in this post about web
development:

[https://www.cycligent.com/](https://www.cycligent.com/)

That is all.

