

Announcing TypeScript 0.9.1 - novaleaf
http://blogs.msdn.com/b/typescript/archive/2013/08/06/announcing-0-9-1.aspx

======
sdevlin
I sometimes find myself torn between dynamic typing (great for rapid
prototyping) and static typing (great for tooling and compile-time error
checks).

I'm a big fan of TypeScript's approach, which gives you the best of both
worlds. Start with fully dynamic code to explore the problem space, then add
more static guarantees as you firm up your design.

I haven't had occasion to write a big web app recently, but I'm itching to
find one so I can put TypeScript through its paces.

~~~
delambo
I think the greatest advantage to static typing is the IDE support. Compile-
time error checking is overrated, and in my several years of writing
JavaScript, I've never seen a bug in production that could have been prevented
with static analysis. That might be because I know the language well, but it's
not a feature I need.

"What's true of all bugs? They passed a type checker and they passed the
tests!" \- Rich Hickey

~~~
sdevlin
Your point is well taken, but I think it has value. Compile-time error
checking is useful because it gives you flexibility to make changes in a big
program. It's kind of like a big suite of automatic tests that make sure all
the parts of your program talk to each other correctly.

Does it catch everything? Can you stop thinking critically? No, but it's still
nice to have.

This sort of goes hand in hand with IDE tools (e.g. "change method name" sorts
of things), so I don't think we necessarily disagree.

> I've never seen a bug in production that could have been prevented with
> static analysis.

That seems unlikely to me.

I do application penetration testing for a living, and I'll often use static
analysis tools in my work. (Both robust, established tools and ad hoc
scripts.) For example, check out Brakeman for Rails apps. These tools find
actual bugs in actual production software.

Do they find everything? No, you can't rely on them completely. But they're
still nice to have.

------
sluukkonen
Does anyone have experience with using TypeScript with existing libraries like
Angular.js?

I know that there are definition files for it [1] (and many other popular
libraries), but unfortunately I haven't had the time to check out their
quality.

[1]
[https://github.com/borisyankov/DefinitelyTyped/tree/master/a...](https://github.com/borisyankov/DefinitelyTyped/tree/master/angularjs)

~~~
santialbo
We are building a webapp using TypeScript and Angularjs and we are quite
happy. It takes some time to set up everything, we even created our own yeoman
generator, but at the end I think it's worth it.

~~~
knocte
That seems like pretty awesome, are you hiring?

~~~
novaleaf
i am (we use typescript + angular + node) but you'd have to be willing to move
to thailand. can apply at novaleaf.com/career

------
jzelinskie
I haven't heard much about TypeScript since its original announce. Are any big
projects using it? Does anybody have some commentary on their experience using
it and where they think the project is going?

~~~
shearnie
My project isn't huge, but larger than it could have been using idiomatic
javascript.

The scoping with modules and the typing really helped since I'm familiar with
C# and having "everything light up" in the IDE. Saved a ton of time letting a
compiler catch things instead of writing tests.

I tried coffee script, but found the copy/paste option for javascript that I
have already written won me over.

~~~
ajanuary

        Saved a ton of time letting a compiler catch things instead of writing tests.
    

Types should never mean writing less tests :/

~~~
CmonDev
Static typing means automatic language-integrated type-checking unit tests. I
would bet a lot of dynamic language unit testing has to do with compensating
for the lack of proper type checking. It's just like using patterns
compensates for lacking language features.

~~~
ajanuary
I don't like to think about type checking as unit tests because they approach
the problem from a fundamentally different direction, and I worry conflating
them could lead to writing the sort of bad unit tests people are talking about
here.

Type checking, or static analysis in general, checks for the presence of a
particular class of errors.

Unit tests check for correct behaviour, and in doing so imply a lack of any
errors, types or otherwise.

While it can be good to use unit tests to check for regressions in a specific
error, the core of your tests should be specifying the behaviour of your
system, not trying to catch out any specific class of errors.

If your tests are busy looking for specific errors, there will always be some
that you miss (type checking, even in Haskell, misses a lot of classes of
error). If your tests check for correct behaviour, there can be no errors.

Of course, writing tests with perfect coverage and specifying all the
behaviour is impossible, even more so when you've got actual features to get
out the door. So any static analysis you're comfortable with can be great for
making up some of the slack, but let's not pretend that in most cases we
shouldn't now need to be writing those tests to check it does what it's meant
to.

The place where this approach sometimes falls short is on the public API
boundary, as I mentioned in my other post. Types can be useful there, so maybe
my original assertion was a little too strong, but still types should very
rarely mean less tests.

(Apologies if the post is a bit all over the place, redrafting on a phone is
hard)

~~~
CmonDev
I understand your point, thanks.

------
logotype
Announcing LeapMotion TypeScript API:
[https://github.com/logotype/LeapMotionTS](https://github.com/logotype/LeapMotionTS)

------
unknownian
Irrelevant, but a site that lets you comment without putting an email? I like
Microsoft.

~~~
seabrookmx
Agreed.

It's little things like this that add up.

------
dinduks
The problem with TypeScript is its requirement for definition files which are
most of the time outdated. That makes it unusable in a real project where many
JS libs live together. (not saying that's the case all the time)

~~~
dodyg
No, it's not a problem. You don't need the definition files if you don't care
about getting the supporting static typing on external libs.

It is completely doable to simply let the external libs call to be dynamic and
guard your core code with static typing.

------
ghostdiver
Traceur Compiler is good alternative:

[https://github.com/google/traceur-
compiler](https://github.com/google/traceur-compiler)

however its development kinda stopped in last months

------
kishor_gurtu
Love how folks here love to discuss the merits/demerits of a language (not the
version of the language) EVERY TIME a new version is announced. This works for
every language.

~~~
marshray
Me too. But I don't agree that it works for every language.

Often the stuff that "just works" doesn't end up producing a lot of chatter on
the intertubes, at least not nearly as much as something that looks
seductively simple but turns out to be much harder in practice.

Another example I like is Lua: elegant, mature, and used in some very very big
applications. If there was ever evidence that a codebase was high quality and
nearly bug free, it's that. But when was the last time we had a good flamewar
(with namecalling) over Lua?

------
opminion
I hope that they keep the possibility of running it stand-alone and not force
Visual Studio down their users's throats.

~~~
benatkin
Why are you concerned about this? I didn't see anything in the announcement
that would suggest it.

~~~
kyrra
Cause it makes it windows only.

EDIT: to add, I like the idea of typescript (it's a much smaller step than
compared to something like Dart). But their tooling is all around Visual
Studio, which ties you to Windows. I don't dislike Windows, but I want my
development tools to be cross platform (which is why I like Sublime Text,
Eclipse, and similar tools).

~~~
yareally
> _but I want my development tools to be cross platform (which is why I like
> Sublime Text, Eclipse, and similar tools)._

Still not sure why you're complaining. There's great support for TypeScript
for Sublime, Vim, Emacs, Intellij IDEA and Eclipse.

[http://msopentech.com/blog/2012/10/01/sublime-text-vi-
emacs-...](http://msopentech.com/blog/2012/10/01/sublime-text-vi-emacs-
typescript-enabled/)

[http://blog.jetbrains.com/webide/2013/02/typescript-
support-...](http://blog.jetbrains.com/webide/2013/02/typescript-support-in-
webstorm-6/)

[http://marketplace.eclipse.org/content/typescript](http://marketplace.eclipse.org/content/typescript)

~~~
itsmonktastic
This seems a little disingenuous. I bet Intellij already has great support,
but the top link you give there for Sublime Text, emacs and vim doesn't really
give anywhere near the level of support you get in Visual Studio. Literally
just syntax highlighting! In Visual Studio you get at least error
highlighting/completions/code generation/navigation/refactoring.

There are definitely attempts to bring the language service to other editors
but when I tried them last (just before the 0.9 release) they seemed either
featureless or very slow. If someone can recommend one for sublime/emacs/vim
that they actually use I'd be very appreciative!

EDIT: related thing that annoyed me: the language service is part of the
TypeScript repo but as far as I can see from there is no official
documentation on how to go about leveraging it for other editors! I admit I
can kind of understand this until the language is less of a moving target. The
best way to get started for now seems to be looking at third party efforts
like [https://github.com/clausreinke/typescript-
tools](https://github.com/clausreinke/typescript-tools).

~~~
yareally
> _This seems a little disingenuous. I bet Intellij already has great support,
> but the top link you give there for Sublime Text, emacs and vim doesn 't
> really give anywhere near the level of support you get in Visual Studio.
> Literally just syntax highlighting! In Visual Studio you get at least error
> highlighting/completions/code generation/navigation/refactoring._

It's a little disingenuous to expect environments that are typically more text
editor than IDE and much more lightweight (Sublime, Vim, Emacs) to have all
the features of an IDE with as new as TypeScript is. Much of those features
require much more work than they would to implement in Intellij or Visual
Studio, which have great APIs for building plugins with those sort of
features[1] even for the community[2].

[1]
[http://confluence.jetbrains.com/display/IntelliJIDEA/Custom+...](http://confluence.jetbrains.com/display/IntelliJIDEA/Custom+Language+Support)

[2]
[http://plugins.jetbrains.com/plugin?pluginId=5055](http://plugins.jetbrains.com/plugin?pluginId=5055)
(The third party Lua plugin for Intellij for example)

~~~
itsmonktastic
Sorry for the poor choice of word on my part, I admit I was using
"disingenuous" incorrectly there. I just thought the description of
sublime/emacs/vim having "great" support for TypeScript might give someone the
impression that something beyond syntax highlighting was supported.

I don't doubt that it's more work to support more than syntax highlighting,
but that doesn't change the fact that the support in those editors is sub-par
when compared with lots of other languages. For example I can install
SublimeLinter and have basic error reporting for python code, or SublimeJEDI
and have code completion and go to definition.

------
chris-at
I appreciate their efforts but this is the 'buggiest' release yet.

------
ledneb
We need support for it in something like Monodevelop / Netbeans / Eclipse. A
lot of the benefit I experience from strict(er) typing comes from the real-
time help an IDE gives me - without a Windows/VS licence, I hardly feel
compelled by Typescript at all.

~~~
camus
works well with webstorm/phpstorm but i agree , useless without realtime help
in a IDE.

Sometimes the compiler issues an error it is really hard to get what's wrong
without visual clues , unless one likes to count lines and columns and switch
between command line / text editor all the time.

Does the TS compiler even work with Syntastic(vim) by the way ?

I like TS , i use modules , classes and short hand functions declarations ,
but not the type system which doesnt make sense to me. It doesnt make sense
with javascript and force back devs in all these java EE like patterns.

------
andor
Does anybody know whether Typescript still filters comments?

~~~
novaleaf
it's a command-line argument --removeComments, install and run tsc.exe with no
args for the full list of options

------
coolsunglasses
Solid alternative:
[http://ckknight.github.io/gorillascript/](http://ckknight.github.io/gorillascript/)

~~~
sinkasapa
It doesn't look like GorillaScript has static typing, which I thought was the
point of TypeScript. I think a great alternative in that space is Roy
[http://roy.brianmckenna.org/](http://roy.brianmckenna.org/)

------
deadreturns3
Am justing waiting for them to implement "await".

~~~
Permit
I think you might be waiting for awhile unfortunately. Implementing await
would result in a lot of autogenerated code. Typescript is largely meant to be
almost 1:1 with the Javascript it produces.

Anders talks about that problem in this video:
[http://channel9.msdn.com/Events/Build/2013/9-006](http://channel9.msdn.com/Events/Build/2013/9-006)

~~~
omphalos
One proposed alternative to await (for CoffeeScript) that is more one-to-one
with the generated JavaScript: [https://github.com/jashkenas/coffee-
script/issues/2762](https://github.com/jashkenas/coffee-script/issues/2762)

