
Why Asana Is Switching to TypeScript - pspeter3
https://eng.asana.com/2014/11/asana-switching-typescript/
======
klibertp
"The Surprising Benefits of Static Typing"

It's actually "gradual typing", which among many benefits shared with full
static typing has one very important of its own: it gets out of your way when
you want to ignore the types. The approach itself is old(EDIT: Common Lisp and
Dylan), the research and theory behind it is a decade old at this point, this
shouldn't be very surprising anymore :)

~~~
steveklabnik
Decade-old PLT is still generally 'zomg super new' for industry languages,
though. It's one area of computer science where industry really trends far
behind research.

------
programminggeek
I wish TypeScript checked types at runtime.... boo...

The only language that I've seen in JS land that is trying to get this right
is AtScript from the Angular team.

[https://docs.google.com/document/d/11YUzC-1d0V1-Q3V0fQ7KSit9...](https://docs.google.com/document/d/11YUzC-1d0V1-Q3V0fQ7KSit97HnZoKVygDxpWzEYW0U/mobilebasic?viewopt=127)

Looks interesting so far.

~~~
pspeter3
Why do you want TypeScript to check types at run time? Integration with other
JavaScript code?

~~~
mjibson
Validation of JSON responses is the big win.

~~~
pspeter3
Ah that would be cool. We actually code generate interfaces for our responses
which is really helpful.

~~~
recursive
Typelite is good for this.

------
wasd
I don't want to keep adding to the comments about why not X so I'll ask a more
generalized question, what other options did you consider and why did you
abandon them?

~~~
pspeter3
We looked at PureScript, ClojureScript, LiveScript, CoffeeScript, Dart, and
compile language X to JS tools. We wanted static typing for run time
correctness with respect to accessing data loaded from a server so that ruled
out the dynamically typed variants like CoffeeScript. We also did not want to
force our developers to learn a new language so that really only left
TypeScript. At the time we were investigating, Flow by Facebook and AtScript
by Google were not out yet. It seems like TypeScript will play well with Flow
which is nice.

------
wildpeaks
About the React post mentioning improvements from types: React wanted to use
Typescript (see
[http://youtu.be/M8x0bc81smU?t=37m57s](http://youtu.be/M8x0bc81smU?t=37m57s)),
but they created Flow instead because Typescript didn't fit them, so the
performance improvements the post mentions came from Flow instead.

------
hippich
I came from requirejs code base into new typescript based with rjs used to
load modules. I found many small nuances I had to fight about the way
typescript generates and uses rjs modules. With browserify-type of modules
that should not be a problem tho.

------
jbeja
Why not purescript?

~~~
pspeter3
Largely because of the difference from vanilla JavaScript syntax. PureScript
looks great but would be asking for a lot of change just like Scala.js. We
also looked at ClojureScript and LiveScript

------
alexfreska
I may be wrong but didn't they write their own language that compiles to
javascript?

~~~
marcog1
We did long ago, but ditched that idea because we get to use the tools of JS
and we realised that effectively using a DSL embedded in another language
allows the developer to break the rules of the DSL.

~~~
hackerboos
Surely those points apply to TypeScript.

~~~
malcolmredhero2
Lunascript was very different from JavaScript, partly because it had automatic
support for our reactivity system. As a result it compiled to JavaScript that
looked nothing like the original code (even the control flow was different).
Reading this code was very difficult.

