
Announcing TypeScript 1.8 Beta - DanRosenwasser
http://blogs.msdn.com/b/typescript/archive/2016/01/28/announcing-typescript-1-8-beta.aspx
======
bunkerbewohner
This is brilliant! The first three features, i.e. --allowJs, --reactNamespace,
and stateless functional componentshave been precisely the things that I have
been missing recently.

This makes integrating 3rd party JS libs much easier and I can streamline my
components a little since I'm almost exclusively using stateless components
anyway.

That already made me quite happy. But as I'm reading on I almost can't believe
all the other great additions, such as module augmentations, string literal
types, AMD module concatenation, let/const in loops. It's like they've been
reading my mind. These were all things on my wishlist. Great work!

------
DanRosenwasser
Also check out our "What's New in TypeScript" page[1] for a little more
detail.

[1] [https://github.com/Microsoft/TypeScript/wiki/What's-new-
in-T...](https://github.com/Microsoft/TypeScript/wiki/What's-new-in-
TypeScript)

~~~
cpeterso
Does Microsoft use TypeScript for any of its other products or web services?
How strongly are Microsoft web teams encouraged to dogfood TypeScript? :)

~~~
altano
TypeScript is looked upon very highly by everyone at MS and I haven't seen any
new projects started with vanilla JS in the last few years. No one needs to
encourage anyone to use it. It's just the obvious choice for large projects
(and every project at MS is large).

Some other products using it off the top of my head: Azure Machine Learning,
Xbox Music, Visual Studio Team Services. EVERYTHING new.

~~~
lenkite
Sadly, Microsoft's main JS library for UI development - WinJS 4.x is _not_
TypeScript enabled.

~~~
judah
While WinJS is not built in TypeScript, there are TypeScript bindings for
it[0] bundled in the WinJS repo, so it's easy to use from TypeScript.

[0]:
[https://github.com/winjs/winjs/tree/master/typings](https://github.com/winjs/winjs/tree/master/typings)

------
rekoros
TypeScript is amazing. We decided on TS to build
[https://sameroom.io](https://sameroom.io) and never looked back!

~~~
meowface
Cool application. It's something I've wanted for a while, and I'd probably use
it. But linking it here apropos of almost nothing seems a little like
shilling.

~~~
rekoros
Hey - thanks!

Proper TypeScript usage is still pretty rare, so this felt OK.

As a startup founder, if you have a choice between telling people about your
startup and not telling: tell. This is incredibly hard for engineers, but you
just have do it.

Sometimes I wonder, how many amazing technologies have died because the
founders simply couldn't ever figure out how to tell the world about what they
built.

~~~
voltagex_
Can you elaborate on how you got started on TypeScript? What IDEs and editors
are you using? What build process? How did you handle integration with non-TS
libraries? Are there any problems you faced that you wouldn't have, had you
stuck with JS? (I'd read a blog post about this, by the way)

~~~
TheWiseOne
Visual Studio Code, WebStorm have excellent support for TS built-in. There is
also CATS ([https://github.com/jbaron/cats](https://github.com/jbaron/cats))
that's targeted towards TypeScript.

For Sublime, Atom, etc. there are a bunch of plugins that you can download:

[https://github.com/Microsoft/TypeScript-Sublime-
Plugin](https://github.com/Microsoft/TypeScript-Sublime-Plugin)

[https://atom.io/packages/atom-typescript](https://atom.io/packages/atom-
typescript)

Check out the DefinitelyTyped
([http://definitelytyped.org](http://definitelytyped.org)) and Typings
([https://github.com/typings](https://github.com/typings)) for type
definitions to most of the popular JS libraries. There is also a list of some
useful tools and utilities on the DefinitelyTyped website but here are a few
that might be useful:

[https://github.com/palantir/tslint](https://github.com/palantir/tslint)

[https://github.com/TypeStrong](https://github.com/TypeStrong)

[https://github.com/sebastian-lenz/typedoc](https://github.com/sebastian-
lenz/typedoc)

[https://github.com/ivogabe/gulp-typescript](https://github.com/ivogabe/gulp-
typescript)

[https://github.com/Asana/typed-react](https://github.com/Asana/typed-react)

~~~
acidity
Seems like you used React for the project above. Did you build a
view/controller framework in house or something more common?

------
jonesb6
My dream is to have enough free time to rewrite a large open source project
from es5/6 to typescript. One day..

Edit: I meant refactoring as a way to improve the project, learn typescript,
and learn the project itself inside and out.

~~~
nothrabannosir
I don't know if you're setting me up for a joke here, but you're putting the
ball an inch away from an open goal:

Javascript _is_ Typescript. Typescript ⊇ Javascript.

Especially if you already use Babel (or any other JS preprocessor, like uglify
or concat) and have a build pipeline ready, you can start using Typescript
today.

Don't miss out!

PS: It will throw a lot of errors on a conventional codebase, but compile
despite them. That's the point; install the compiler today, slowly start
fixing the errors as you go. It's all about gradual improvement and optional
typing.

~~~
seivan
There are still issues with type definitions for third party libraries. I love
TypeScript and would love to work on it full time, but it's painful when you
need to use a dozen third party code. Unless this has been solved recently, I
remembered tds files weren't updated regularly.

~~~
nothrabannosir
This myth really needs to die. Sorry for the harsh language, it's the TS
team's fault for not taking this ongoing PR blunder seriously.

You can (and always could) use almost _any_ 3rd party lib with literally one
line of code:

    
    
        var somelib: any;
    

Done. No need to ever touch a .d.ts file.

Sure, no type safety on the lib. But isn't that where we started, anyway?

This should be put on a giant banner on the TS homepage.

~~~
seivan
I'm not bothered by silly things like tone or harsh language, _especially_ for
such amazing news. I've actually written my fair share during the summer and I
never knew about this.

Thank you! How well would this work with an editor and typescript plugins? Say
the amazing typescript-atom, I would guess the editor would crap its pants,
no?

~~~
DCoder
A better way would be to do like Arnavion said, for really global libraries
you should create a .d.ts file and put this line in it:

    
    
        declare var somelib: any;
    

Done. Now the compiler and everything else will know that there's a global
variable called `somelib` that does not have a specific type, and no matter
how you use that variable, it's ok, you know what you're doing.

------
igl
I recently learned that the TS type-checker is unsound on purpose and i am a
bit disappointed.

[http://tryflow.org/#2944d91c10fc5d76faeebbb20cac466a](http://tryflow.org/#2944d91c10fc5d76faeebbb20cac466a)
Try this snippet in TS.

~~~
altano
Why is this line an error?:

> var cats : Cat[] = [ new Cat() ]

~~~
DCoder
It would not be an error if not for `addToList(cats, new Dog())`. Based on
that call, Flow infers that `cats` has to be a `Dog[]`, not `Cat[]`.

------
breck
"For example, for a quick ES6 to ES5 downlevel conversion using the TypeScript
compiler, you just need the following command: > tsc --allowJs --outDir out
target_file.js"

Is the intent here to allow tsc to be used as a replacement for babel?

~~~
scott_o
I don't think so. Last time I checked they don't do any polyfills, instead
relying on commonJS for that.

------
nikolay
I am really puzzling what is Microsoft trying to accomplish here? Eventually a
C# that compiles to JavaScript? TypeScript is a great language, and
surprisingly (or not) it's more successful than Dart. Now, of course, I want
TypeScript to compile to CLR as well. :)

~~~
Analemma_
I think people read into TypeScript too much. It's just a "right-now minimal-
hassle" way to make front-end dev's lives easier, nothing more.

Maybe Microsoft disagrees, but I see TypeScript as something intended to make
itself obsolete: eventually, when all browsers are running ES9 (or whichever
version we decid has fixed "all" of JavaScript's problems) or WebAssembly (and
we're all writing front-end code in C#/C++/Ruby/whatever), then TypeScript
will just fade away, by design. For now, it's kinda like JQuery in motivation
if not literally architecture: it shields you from browser inconsistencies (in
this case, where you don't know what ES version the target is running) and
helps you avoid JavaScript's headaches. Just as JQuery became less necessary
as time went on-- not because it got worse but because browsers got better--
so too will TypeScript.

~~~
qaq
by the time all the browsers will run ES(x) ES(y) will be out and everyone
will be transpiling ES(y) to ES(x). Given the developer base it's very
unlikely to go away.

------
pippy
I love TypeScript - it's my favorite precompiled language and I use it for a
few personal projects of mine. But I can't help but feel it's an evolutionary
dead end. asm.js / web assembly is what you want transcompiled languages to
target

~~~
ybx
Someone in Mozilla came up with a language called LLJS, that took full
advantage of and compiled down to asm.js.

It looked like it had some promise, since it wasn't nearly as heavy as
emscripten, but I don't think much has happened with it since it was created.

~~~
pippy
Interesting, I've only ever known about Emscripten based asm.js compilers.
TypeScript + LLVM have the benefit of being actively developed with a strong
community backing.

------
_pmf_
It would be refreshing if the ES evolution would take some hints from
TypeScript instead of satisfying the perceived need for syntactic sugar and
cutesey poor man's FP.

------
VeilEm
> While React has paved the way, JSX syntax is not only tied to React.

Does TypeScript manage the lifecycles of elements you create through their
version of JSX? React creates an in memory version of the DOM and reconciles
changes to the DOM against this. Is TypeScript doing this too or is this
simply template syntax inside JavaScript? What React does is not simply
template syntax. HTML and JSX are totally different things! JSX renders to
HTML eventually, but there's way more going on.

~~~
Guillaume86
You're mixing up React and JSX. Typescript do not replace React, it just
allows JSX syntax and transforms it to javascript for you if you want.

~~~
WorldMaker
Also, Typescript type checks the JSX. This was the big thing that convinced me
to start using TSX was typed views. (I've not been using React, so I've been
using preserve behavior and Babel to feed the Virtual DOM library I am using.)

------
crudbug
When can we see CoreCLR backend for TypeScript ?

~~~
chinhodado
What do you mean by that?

~~~
crudbug
Current TS is targeting JS backend. CoreCLR backend would mean you will have a
unified codebase both on browser and server (CLR VM).

~~~
dham
Not sure I follow. You can use Typescript on the server already with Node.js.
The CLR isn't available in the browser.

~~~
girvo
I'm guessing parent means compiling TypeScript down to CoreCLR bytecode
instead of to Javascript and running through Node for execution. Pretty big
job, that one.

~~~
crudbug
Not running through Node, Just run CoreCLR TS code as a backend server similar
to ASP.NET

~~~
girvo
Sorry, I wasn't clear, that's what I meant. I was using running the code
through Node as the current situation, and trying to communicate you meant the
opposite of that :)

------
scotty79
Still no love for typing of `this` or `call()` and such

~~~
Ycros
Can you elaborate on what you mean by that? 1.7 added 'this' typing
improvements, and it looks like 1.8 is adding 'this'-based type guards.

~~~
scotty79
I mean, when specifying function type, you can't specify type of `this` that
the function expects to be run with. And `call()` expects thisArg:any,
...args:any[] for all functions regardless of their declared parameter types
and expected type of `this`.

I'm talking about the usual js `this`, the covertly passed parameter, not
typescript `this`, type of own class.

Funny they focused so much on classes that they reached 1.8 without so much as
touching js most unique feature, flexible `this`.

------
z3t4
I think type-script is great. But what's true for every bug that ever
existed!? It passed the type checker!

------
slantview
[https://xkcd.com/927/](https://xkcd.com/927/)

~~~
jbrantly
I don't think this applies. I don't believe anybody else was doing what
TypeScript does when it was released, that is JavaScript + Type Safety. Even
today the only other real contender is Flow.

~~~
johnny_reilly
What jbrantly said. I love JavaScript and I love optional static typing.
That's exactly what TypeScript provides.

