TypeScriptCompileBlocked

TypeScriptCompileBlocked If you are using a different build tool to build your project (e.g. gulp, grunt , etc.) and VS for the development and debugging experience, set <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked> in your project. This should give you all the editing support, but not the build when you hit F5.

TypeScript 1.7

async/await support in ES6 targets (Node v4+) TypeScript now supports asynchronous functions for engines that have native support for ES6 generators, e.g. Node v4 and above. Asynchronous functions are prefixed with the async keyword; await suspends the execution until an asynchronous function return promise is fulfilled and unwraps the value from the Promise returned. Example In the following example, each input element will be printed out one at a time with a 400ms delay: "use strict"; // pr

TypeScript 1.8

Type parameters as constraints With TypeScript 1.8 it becomes possible for a type parameter constraint to reference type parameters from the same type parameter list. Previously this was an error. This capability is usually referred to as F-Bounded Polymorphism. Example function assign<T extends U, U>(target: T, source: U): T { for (let id in source) { target[id] = source[id]; } return target; } let x = { a: 1, b: 2, c: 3, d: 4 }; assign(x, { b: 10, d: 20 }); assign(x, { e: 0 }

TypeScript 1.6

JSX support JSX is an embeddable XML-like syntax. It is meant to be transformed into valid JavaScript, but the semantics of that transformation are implementation-specific. JSX came to popularity with the React library but has since seen other applications. TypeScript 1.6 supports embedding, type checking, and optionally compiling JSX directly into JavaScript. New .tsx file extension and as operator TypeScript 1.6 introduces a new .tsx file extension. This extension does two things: it enables

TypeScript 1.4

Union types Overview Union types are a powerful way to express a value that can be one of several types. For example, you might have an API for running a program that takes a commandline as either a string, a string[] or a function that returns a string. You can now write: interface RunOptions { program: string; commandline: string[]|string|(() => string); } Assignment to union types works very intuitively – anything you could assign to one of the union type’s members is assignable to

TypeScript 1.5

ES6 Modules TypeScript 1.5 supports ECMAScript 6 (ES6) modules. ES6 modules are effectively TypeScript external modules with a new syntax: ES6 modules are separately loaded source files that possibly import other modules and provide a number of externally accessible exports. ES6 modules feature several new export and import declarations. It is recommended that TypeScript libraries and applications be updated to use the new syntax, but this is not a requirement. The new ES6 module syntax coexist

TypeScript 1.3

Protected The new protected modifier in classes works like it does in familiar languages like C++, C#, and Java. A protected member of a class is visible only inside subclasses of the class in which it is declared: class Thing { protected doSomething() { /* ... */ } } class MyThing extends Thing { public myMethod() { // OK, can access protected member from subclass this.doSomething(); } } var t = new MyThing(); t.doSomething(); // Error, cannot call protected member from outside clas

Types

Generic Types In previous sections, we created generic identity functions that worked over a range of types. In this section, we’ll explore the type of the functions themselves and how to create generic interfaces. The type of generic functions is just like those of non-generic functions, with the type parameters listed first, similarly to function declarations: function identity<T>(arg: T): T { return arg; } let myIdentity: <T>(arg: T) => T = identity; We could also have use

Type Guards and Differentiating Types

Type Guards and Differentiating Types Union types are useful for modeling situations when values can overlap in the types they can take on. What happens when we need to know specifically whether we have a Fish? A common idiom in JavaScript to differentiate between two possible values is to check for the presence of a member. As we mentioned, you can only access members that are guaranteed to be in all the constituents of a union type. let pet = getSmallPet(); // Each of these property accesses

TypeScript 1.1

Performance Improvements The 1.1 compiler is typically around 4x faster than any previous release. See this blog post for some impressive charts. Better Module Visibility Rules TypeScript now only strictly enforces the visibility of types in modules if the --declaration flag is provided. This is very useful for Angular scenarios, for example: module MyControllers { interface ZooScope extends ng.IScope { animals: Animal[]; } export class ZooController { // Used to be an error (cannot e