August 6th, 2013

Announcing 0.9.1

We’re happy to announce the release of TypeScript 0.9.1.  With this version we’ve focused on fit and finish, improving the compiler performance and rounding out the language and ASP.NET support.

Improved Performance

When we released 0.9.0, we introduced a re-written compiler and language service which scaled better for interactive use cases and supported many new 0.9 language features, including generics.  One side-effect of this re-write was that command line compiler performance was noticeably slower than in 0.8.3.  With 0.9.1, the compiler is now as fast or faster than 0.8.3 for almost all codebases.  With 0.9.1, we close many of the performance gaps introduced by 0.9.0, improving both interactive and compiler performance.  Windows 8 and 8.1 users of the Visual Studio plugin will also notice further performance improvements, as we’ve begun using the latest version of Chakra, the JavaScript engine, on those platforms.

New Language Features

Typing with ‘typeof’

We’ve added support for the ‘typeof’ operator in type positions.  This allows you a way of referring to the type of an expression. This is especially handy for working with the shapes of modules, the static side of a class, and enums, which don’t otherwise have a name you can refer to.

module M {     export function myFun(x: number) {         return x;     } }

var m: typeof M = M;

Better ‘this’ handling

We’ve relaxed the restrictions on field initializers to now allow ‘this’.  This means that classes can now contain both methods on the prototype, and callback functions on the instance.  The latter are particularly useful when you want to use a member on the class as a callback function, as in the code above. This lets you mix-n-match between ‘closure’ style and ‘prototype’ style class member patterns easily.

class Adder {     constructor(public x: number, public y: number) { }

    addMembers = (evt: MouseEvent) => console.log(this.x + this.y); }

var adder = new Adder(3, 4);

document.onclick = adder.addMembers;

No Implicit Any

In the TypeScript 0.8 releases, there was an experimental option to warn anytime the compiler implicitly inferred the type ‘any’ where it had not been explicitly stated by the developer.  Several teams discovered this and began to use it to ensure they were taking full advantage of the TypeScript type checker, and not having ‘any’ creep in accidentally.  With 0.9.1, we are adding full support to this option, which is now available through the ‘–noImplicitAny’ compiler flag.  For Visual Studio users, we now also support the <TypeScriptNoImplicitAny> project build option.

var x;             // Error: Variable ‘x’ implicitly has an ‘any’ type

x = “foo”; x = 2;

function f(y) {    // Error: Parameter ‘y’ of f implicitly as an ‘any’ type     return y + 1; }

 Visual Studio support for ASP.NET projects

Image 8625 nuget3

With 0.9.1 on Visual Studio, we have introduced better support for using TypeScript within ASP.NET applications.  Keep an eye on the blog for an in-depth look at the features that are now available.

Download

Get them while they’re hot.  The updated downloads are available for Visual Studio, NPM and source through the TypeScript website.  Let us know what you think on the discussion forums and issue tracker.

Note to users of previous versions of TypeScript – there is a list of breaking changes with older versions listed here

Category
TypeScript

0 comments

Discussion are closed.