
Announcing TypeScript 1.6 - pingec
http://blogs.msdn.com/b/typescript/archive/2015/09/16/announcing-typescript-1-6.aspx
======
spion
So, with TSX support in TypeScript, node and react-native, its now possible to
write end-to-end type checked web and mobile applications (from database to
templates). With full language service support (refactoring, intelligent
navigation etc) that is also exposed via a standalone language service
distributed with the compiler relatively easy to integrate with any editor.
All that while seamlessly leveraging the entire node (and JS) ecosystem (just
add a few definition files). And there even is a free, cross-platform editor
that packages it all into one neat package:
[https://code.visualstudio.com/](https://code.visualstudio.com/)

Seriously, how cool is that? (Even though admittedly there are soundness
issues with TypeScript, its still pretty damn amazing)

~~~
applecore
With Flow and React DOM/Native, you already get complete type-checking across
mobile, native, and web application.

~~~
patrickaljord
For those wondering, more info here
[https://babeljs.io/docs/advanced/transformers/other/flow/](https://babeljs.io/docs/advanced/transformers/other/flow/)

------
matchu
I don't know much about type theory, so I suspect that my intuition is wrong,
but the phrase "intersection type" violates my intuition.

If I have Printable and Drawable interfaces, which each describe a set of
behaviors, then I would expect the "intersection" of Printable and Drawable to
be the intersection of those sets of behaviors — which, here, is likely the
empty set.

Is there another way of understanding types that makes the word "intersection"
make more sense here? Or is it just to say that "where union types say OR,
intersection types say AND"?

\---

...ya know what? By typing it out, I think I get it now.

The set that we're talking about isn't the set of Printable's behaviors; it's
the set of things that implement Printable. `Printable & Drawable` is the
intersection of the set of types that implement Printable with the set of
types that implement Drawable. Got it. Thanks for rubber-ducking for me, HN!

~~~
CurtHagenlocher
I found some of the comments at
[http://stackoverflow.com/questions/5653678/union-types-
and-i...](http://stackoverflow.com/questions/5653678/union-types-and-
intersection-types) helpful. If TAPL refers to "intersection types" then it's
definitely a well-defined concept.

~~~
zeckalpha
There's also sum and product types, again by analogy.

------
judah
Nothing hugely sexy in this release, but a few small nice things like custom
type guards.

Really looking forward to async/await support[0]. This will simplify vast
swaths of async code trapped in callback hell or promise purgatory.

It appears async support has been pushed out until TypeScript 2.0.

[0]:
[https://github.com/Microsoft/TypeScript/issues/1664](https://github.com/Microsoft/TypeScript/issues/1664)

~~~
ken47
I disagree. Abstract classes, generators, and built-in JSX support are
definitely "sexy."

~~~
judah
Generators are not in TS 1.6.

JSX support is a big feature, albeit controversial and not for everyone.
Notice Rob Eisenberg's first comment on the blog:

"I do have one concern with this release. Back in the day, Anders was
extremely adamant about not including XML in C#. At the time, XML was
extremely popular, but today it is much less so. It was a wise decision.
Today, I see a release that ties TypeScript to JSX, which seems to fly in the
face of the previous language design principle. But furthermore, it is a long
held principle that one should not embed JavaScript in HTML. So, why are we so
quick to embed HTML in JavaScript? JSX has always seemed like a phenomenally
bad idea and one that is certain to be short lived. Can you elaborate on the
nature of the JSX integration? I'd like to know that it's not going to affect
TS in the long-term. I'd also like to know what type of compiler output it
produces. Does it produce React code? or does it produce some sort of string
concatenation expression in the end? Did the TS compiler just get tied to the
React library's implementation details?"

------
aikah
I like Typescript, however it leads to that "Enterprise Javascript" coding
style I really hate, pushing OOP Java style over simple functional
programming.

But I admit that being able to read type signatures in the source code makes
understanding a code base way easier, it's just that people tend to be more
verbose going full OOP , even when it is not necessary. But kudos for
Microsoft, if only they would have accepted ES4 8 years ago, TS would not have
been needed.

And by the way Microsoft, why not make Jscript.net cool again ?

~~~
dangoor
I don't see how TypeScript leads to "Enterprise JavaScript" any more than
ES2015 does, given the new class syntax.

If I was writing TypeScript, I'd be using functions and simple objects.

~~~
andreime
It helps people who don't know JS code for JS. And it helps people like c# /
java devs just writing code without learning more that typescript. This is
very powerful but it also can lead to Enterprise-like code writing.

------
WhitneyLand
Does TS really require type files for every JS library you use?

I tried to use it the other day with node.js but couldn't find a type file for
the popular simple-oauth2 package.

~~~
spion
You can say that the library is of "any" type and the compiler will accept all
method calls on it.

However it should be fairly easy to write a .d.ts file for it. You don't even
have to cover the entire library - its enough to specify the types of the
parts you use.

------
mwsherman
Type guards offer just a bit of magic, similar to type switches in Go:
[https://golang.org/doc/effective_go.html#type_switch](https://golang.org/doc/effective_go.html#type_switch)

------
msoad
So JSX is not enabled by default, right?

~~~
WorldMaker
You have to use the .TSX filename extension to enable it.

~~~
evmar
I was just playing with this today. I didn't realize it was so new! I filed a
bug about the extension with the related emacs mode and it's already fixed:
[https://github.com/fxbois/web-mode/issues/585](https://github.com/fxbois/web-
mode/issues/585)

------
chinhodado
Is there an updated extension for Visual Studio yet?

~~~
mohamedhegazy
If you are using VS 2015, TypeScript is accessible through the Extensions &
updates window.

For downloading plugin for VS 2015 available at:[http://www.microsoft.com/en-
us/download/details.aspx?id=4859...](http://www.microsoft.com/en-
us/download/details.aspx?id=48593&WT.mc_id=DX_MVP4025064)

and VS 2013 available at: [http://www.microsoft.com/en-
us/download/details.aspx?id=4873...](http://www.microsoft.com/en-
us/download/details.aspx?id=48739&WT.mc_id=DX_MVP4025064)

