Announcing TypeScript 1.0RC

Announcing TypeScript 1.0RC

Rate This
  • Comments 42

We’re happy to mark another significant milestone for the TypeScript project with the release of the 1.0 Release Candidate.  Since the first release in October of 2012, the TypeScript language has grown to support generics, which enables rich typing of JavaScript libraries.  Last December, the release focused on better performance and reliability for larger codebases.  Today, we're making the 1.0RC release available, which represents the culmination of this work as a feature-complete TypeScript 1.0 language with a spec-conformant compiler and a production-level language service capable of working with codebases with hundreds of thousands of lines of code.

For developers using Visual Studio 2013, the Spring Update CTP2 includes TypeScript support, making TypeScript a first-class Visual Studio language.  The TypeScript 1.0RC release is also immediately available for Visual Studio 2012 and 2013 development as a standalone power tool and as a cross-platform tool via the npm package.  As always, you can access the source via CodePlex(please note: The 1.0RC release is also called '0.9.7' in the installer and compiler)

Among the usual set of bugfixes, TypeScript 1.0RC focuses on a few key areas based on user feedback on 0.9.5: a simpler type system, an improved lib.d.ts, and a more natural declaration merge order.

Simpler Type System

For the 1.0RC release, we’ve simplified the type system in two ways: the ‘any’ type now works more consistently as a wildcard, and we’ve also made generics work better with complex types, informed by real-world user examples trying to type JavaScript promises.  By making these simplifications, the type system becomes easier to use and easier to reason about.

As an example, the TypeScript 1.0RC type system now allows the user to use ‘any’ as a way around typechecking when subclassing and implementing interfaces, in addition to being able to use it as a wildcard to satisfy generic constraints.  

class Shape {
    area: number;
}

class ImaginaryShape extends Shape {
    area: any// causes errors in 0.9.5, but valid in 1.0RC
}

Second, we’ve made it easier to understand when generic types are compatible.  We’ve replaced the more complex, and error-prone, approach of 0.9.5 with the simpler rule that a generic type is compatible with another type if, once instantiated with ‘any’ for all generic type parameters, the resulting type is compatible.  This allows greater flexibility when working with the types of complex generic types that occur in common JavaScript patterns, including fully-typed generic promise typings, as in this example.

interface Promise<Value> {
    result: Value;
 
    then<T2>(f: (v: Value) => Promise<T2>): Promise<T2>;
    then<T2>(f: (v: Value) => T2): Promise<T2>;
}
 
class PromiseImpl<Value> implements Promise<Value> {
 
    result: Value;
 
    then<T2>(f: (v: Value) => Promise<T2>): Promise<T2>;
    then<T2>(f: (v: Value) => T2): Promise<T2>;
    then<T2>(f: (v: Value) => any): Promise<T2> {
        return undefined;
    }
}

Declaration Merging

We’ve also made declaration merging of overloads use a more natural order.  Starting with TypeScript 1.0RC, overloads from later interfaces will merge before overloads of earlier interfaces.  This allows you to reference a library like jQuery and then follow it with references to the jQuery plugins you want to use, and the jQuery plugins would now get the expected higher precedence during overload resolution, as in an example like this:

interface MyLib {
    handleInput(x: number): void;
    handleInput(x: string): void;
}
interface MyLib {
    handleInput(x: Date): void;
    handleInput(x: { abc: string }): void;
}

effectively becomes this definition when merged:

interface MyLib {
    handleInput(x: Date): void;
    handleInput(x: { abc: string }): void;
    handleInput(x: number): void;
    handleInput(x: string): void;
}

This new merge order also makes it easier to extend the built-in types and overloads in lib.d.ts, where the user simply needs to add the new overloads using declaration merging without having to change how lib.d.ts is initially referenced.

Improvements to lib.d.ts

A key value of TypeScript is that it offers a rich set of typings out of the box for JavaScript and DOM APIs via the lib.d.ts file that ships as part of TypeScript.  With TypeScript 1.0RC, we’ve updated lib.d.ts to include typings for touch and WebGL development.  This helps brings it up-to-date with the advanced HTML5 features available across platforms and devices.

Path to 1.0

It’s been an amazing journey, and your feedback on the project has helped ensure that TypeScript is a high-quality JavaScript development experience.  We’d like to give a huge “thank you!” to the community that’s grown up around TypeScript as it has matured.  TypeScript 1.0RC is a mature toolset, shaped by a community of users that have used TypeScript to build a rich variety of applications.  We’d love to hear your feedback on this release candidate to help us make TypeScript 1.0 the best it can be.

Leave a Comment
  • Please add 8 and 1 and type the answer here:
  • Post
  • Awesome work! Can't wait to take this for a spin.

  • Awesome work! Can't wait to take this for a spin.

  • The link for the plug in still points to .9.5

  • Does 1.0RC address the optional semicolon issue? I mean, can I turn this "feature" off so that TypeScript handles semicolons in a sensible way for C# developers?

  • @Jason - It could be that the download servers are still updating.  Should clear up later today, if it doesn't definitely let us know.

    @Pierre - I'm not sure I'm familiar with this issue.

  • Touch and WebGL support!!! Cool beans! Can't wait to test out the new release. :)  Keep up the great work!

  • Great news. Lest important piece to add is async support. Add it as soon as possible.

  • An earlier post said "Another important step for 1.0, and for the future of projects that use TypeScript, is that the compiler needs to correctly implement the language specification.  This will allow users to be able to write code and trust that once we get to 1.0, future compiler upgrades will continue to work with their existing code."

    Which language specification did this mean, ES6 or some other non-standard one? If TS 1.0 can't wait for ES6 to solidify, is it possible that there will be a 2.0 in 2015 to get back in sync?

  • @Dave - the TypeScript spec for 1.0.  We're also keeping an eye on ES6 as it solidifies for future TypeScript versions.

  • Want to thank your team for all the hard work. I posted twice with issues on code plex and within a few hours they have responded. Outstanding product and support!

  • Awesome to see what the team's been up to! Looking forward to taking it for a test drive.

  • Has the dependency on IE been removed?

  • Very exciting. Congrats to the team!

  • Great job

  • Hi,

    you broke the generics. It hurts.

    Our current code:

    class UIWorkflow<TPresenter extends BasePresenter> {

       Presenter: TPresenter;

    .....

    }

    class SitzungElementWorkflow<TModel extends SitzungElementModel, TPresenter extends SitzungElementPresenter<TModel>> extends UIWorkflow<TPresenter> {

       Model: TModel;

    ....

    }

    With 1.0 it doesn't compile and it doesn't increase the confidence in the product.

Page 1 of 3 (42 items) 123