You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/release notes/TypeScript 1.1.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
-
# Performance Improvements
1
+
##Performance Improvements
2
2
3
3
The 1.1 compiler is typically around 4x faster than any previous release. See [this blog post for some impressive charts.](http://blogs.msdn.com/b/typescript/archive/2014/10/06/announcing-typescript-1-1-ctp.aspx)
4
4
5
-
# Better Module Visibility Rules
5
+
##Better Module Visibility Rules
6
6
7
7
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:
Copy file name to clipboardExpand all lines: pages/release notes/TypeScript 1.3.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Protected
1
+
##Protected
2
2
3
3
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:
4
4
@@ -17,7 +17,7 @@ var t = new MyThing();
17
17
t.doSomething(); // Error, cannot call protected member from outside class
18
18
```
19
19
20
-
# Tuple types
20
+
##Tuple types
21
21
22
22
Tuple types express an array where the type of certain elements is known, but need not be the same. For example, you may want to represent an array with a `string` at position 0 and a `number` at position 1:
23
23
@@ -43,4 +43,4 @@ Note that in TypeScript 1.4, when accessing an element outside the set of known
43
43
x[3] ='world'; // OK
44
44
console.log(x[5].toString()); // OK, 'string' and 'number' both have toString
45
45
x[6] =true; // Error, boolean isn't number or string
Copy file name to clipboardExpand all lines: pages/release notes/TypeScript 1.4.md
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Union types
1
+
##Union types
2
2
3
3
### Overview
4
4
@@ -79,7 +79,7 @@ x[0] = 'world'; // OK
79
79
x[0] =false; // Error, boolean is not string or number
80
80
```
81
81
82
-
# `let` declarations
82
+
##`let` declarations
83
83
84
84
In JavaScript, `var` declarations are "hoisted" to the top of their enclosing scope. This can result in confusing bugs:
85
85
@@ -103,7 +103,7 @@ else {
103
103
104
104
`let` is only available when targeting ECMAScript 6 (`--target ES6`).
105
105
106
-
# `const` declarations
106
+
##`const` declarations
107
107
108
108
The other new ES6 declaration type supported in TypeScript is `const`. A `const` variable may not be assigned to, and must be initialized where it is declared. This is useful for declarations where you don't want to change the value after its initialization:
109
109
@@ -114,7 +114,7 @@ halfPi = 2; // Error, can't assign to a `const`
114
114
115
115
`const` is only available when targeting ECMAScript 6 (`--target ES6`).
116
116
117
-
# Template strings
117
+
##Template strings
118
118
119
119
TypeScript now supports ES6 template strings. These are an easy way to embed arbitrary expressions in strings:
120
120
@@ -130,7 +130,7 @@ var name = "TypeScript!";
130
130
var greeting ="Hello, "+ name +"! Your name has "+name.length+" characters";
131
131
```
132
132
133
-
# Type Guards
133
+
##Type Guards
134
134
135
135
A common pattern in JavaScript is to use `typeof` or `instanceof` to examine the type of an expression at runtime. TypeScript now understands these conditions and will change type inference accordingly when used in an `if` block.
136
136
@@ -172,7 +172,7 @@ else {
172
172
}
173
173
```
174
174
175
-
# Type Aliases
175
+
##Type Aliases
176
176
177
177
You can now define an *alias* for a type using the `type` keyword:
178
178
@@ -185,7 +185,7 @@ type Callback = () => void;
185
185
186
186
Type aliases are exactly the same as their original types; they are simply alternative names.
187
187
188
-
# `const enum` (completely inlined enums)
188
+
##`const enum` (completely inlined enums)
189
189
190
190
Enums are very useful, but some programs don't actually need the generated code and would benefit from simply inlining all instances of enum members with their numeric equivalents. The new `const enum` declaration works just like a regular `enum` for type safety, but erases completely at compile time.
191
191
@@ -213,13 +213,13 @@ enum MyFlags {
213
213
var b =MyFlags.Best; // emits var b = 7;
214
214
```
215
215
216
-
# `-noEmitOnError` commandline option
216
+
##`-noEmitOnError` commandline option
217
217
218
218
The default behavior for the TypeScript compiler is to still emit .js files if there were type errors (for example, an attempt to assign a `string` to a `number`). This can be undesirable on build servers or other scenarios where only output from a "clean" build is desired. The new flag `noEmitOnError` prevents the compiler from emitting .js code if there were any errors.
219
219
220
220
This is now the default for MSBuild projects; this allows MSBuild incremental build to work as expected, as outputs are only generated on clean builds.
221
221
222
-
# AMD Module names
222
+
##AMD Module names
223
223
224
224
By default AMD modules are generated anonymous. This can lead to problems when other tools are used to process the resulting modules like a bundlers (e.g. `r.js`).
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.
@@ -78,7 +78,7 @@ import "./polyfills";
78
78
79
79
For more information about module, please see the [ES6 module support spec](https://github.com/Microsoft/TypeScript/issues/2242).
80
80
81
-
# Destructuring in declarations and assignments
81
+
##Destructuring in declarations and assignments
82
82
83
83
TypeScript 1.5 adds support to ES6 destructuring declarations and assignments.
84
84
@@ -121,7 +121,7 @@ var y = 2;
121
121
[x, y] = [y, x];
122
122
```
123
123
124
-
# `namespace` keyword
124
+
##`namespace` keyword
125
125
126
126
TypeScript used the `module` keyword to define both "internal modules" and "external modules";
127
127
this has been a bit of confusion for developers new to TypeScript.
@@ -145,7 +145,7 @@ namespace Math {
145
145
}
146
146
```
147
147
148
-
# `let` and `const` support
148
+
##`let` and `const` support
149
149
150
150
ES6 `let` and `const` declarations are now supported when targeting ES3 and ES5.
151
151
@@ -173,7 +173,7 @@ else {
173
173
alert(a); // Error: a is not defined in this scope.
174
174
```
175
175
176
-
# for..of support
176
+
##for..of support
177
177
178
178
TypeScript 1.5 adds support to ES6 for..of loops on arrays for ES3/ES5 as well as full support for Iterator interfaces when targeting ES6.
In addition to `AMD` and `CommonJS` module loaders, TypeScript now supports emitting modules `UMD` ([Universal Module Definition](https://github.com/umdjs/umd)) and [`System`](https://github.com/systemjs/systemjs) module formats.
264
264
@@ -269,7 +269,7 @@ and
269
269
270
270
> tsc --module system
271
271
272
-
# Unicode codepoint escapes in strings
272
+
##Unicode codepoint escapes in strings
273
273
274
274
ES6 introduces escapes that allow users to represent a Unicode codepoint using just a single escape.
275
275
@@ -281,7 +281,7 @@ This has the major downside that it’s difficult to discern two independent cha
281
281
With ES6’s codepoint escapes, you can cleanly represent that exact character in strings and template strings with a single escape: `"\u{20bb7}"`.
282
282
TypeScript will emit the string in ES3/ES5 as `"\uD842\uDFB7"`.
283
283
284
-
# Tagged template strings in ES3/ES5
284
+
##Tagged template strings in ES3/ES5
285
285
286
286
In TypeScript 1.4, we added support for template strings for all targets, and tagged templates for just ES6.
287
287
Thanks to some considerable work done by [@ivogabe](https://github.com/ivogabe), we bridged the gap for for tagged templates in ES3 and ES5.
@@ -308,7 +308,7 @@ function oddRawStrings(strs, n1, n2) {
308
308
var _a;
309
309
```
310
310
311
-
# AMD-dependency optional names
311
+
##AMD-dependency optional names
312
312
313
313
`/// <amd-dependency path="x" />` informs the compiler about a non-TS module dependency that needs to be injected in the resulting module's require call;
314
314
however, there was no way to consume this module in the TS code.
@@ -329,7 +329,7 @@ define(["require", "exports", "legacy/moduleA"], function (require, exports, mod
329
329
});
330
330
```
331
331
332
-
# Project support through `tsconfig.json`
332
+
##Project support through `tsconfig.json`
333
333
334
334
Adding a `tsconfig.json` file in a directory indicates that the directory is the root of a TypeScript project.
335
335
The tsconfig.json file specifies the root files and the compiler options required to compile the project. A project is compiled in one of the following ways:
@@ -351,7 +351,7 @@ The tsconfig.json file specifies the root files and the compiler options require
351
351
352
352
See the [tsconfig.json wiki page](https://github.com/Microsoft/TypeScript/wiki/tsconfig.json) for more details.
353
353
354
-
# `--rootDir` command line option
354
+
##`--rootDir` command line option
355
355
356
356
Option `--outDir` duplicates the input hierarchy in the output.
357
357
The compiler computes the root of the input files as the longest common path of all input files;
@@ -362,18 +362,18 @@ Now if a new file `FolderA\3.ts` is added to the input, the output structure wil
362
362
363
363
`--rootDir` specifies the input directory to be mirrored in output instead of computing it.
364
364
365
-
# `--noEmitHelpers` command line option
365
+
##`--noEmitHelpers` command line option
366
366
367
367
The TypeSript compiler emits a few helpers like `__extends` when needed.
368
368
The helpers are emitted in every file they are referenced in.
369
369
If you want to consolidate all helpers in one place, or override the default behavior, use `--noEmitHelpers` to instructs the compiler not to emit them.
370
370
371
-
# `--newLine` command line option
371
+
##`--newLine` command line option
372
372
373
373
By default the output new line character is `\r\n` on Windows based systems and `\n` on *nix based systems.
374
374
`--newLine` command line flag allows overriding this behavior and specifying the new line character to be used in generated output files.
375
375
376
-
# `--inlineSourceMap` and `inlineSources` command line options
376
+
##`--inlineSourceMap` and `inlineSources` command line options
377
377
378
378
`--inlineSourceMap` causes source map files to be written inline in the generated `.js` files instead of in a independent `.js.map` file.
379
379
`--inlineSources` allows for additionally inlining the source `.ts` file into the `.js` file.
Copy file name to clipboardExpand all lines: pages/release notes/TypeScript 1.6.md
+17-17Lines changed: 17 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# JSX support
1
+
##JSX support
2
2
3
3
JSX is an embeddable XML-like syntax.
4
4
It is meant to be transformed into valid JavaScript, but the semantics of that transformation are implementation-specific.
@@ -52,7 +52,7 @@ TypeScript ships with two JSX modes: `preserve` and `react`.
52
52
53
53
See the [[JSX]] wiki page for more information on using JSX in TypeScript.
54
54
55
-
# Intersection types
55
+
##Intersection types
56
56
57
57
TypeScript 1.6 introduces intersection types, the logical complement of union types.
58
58
A union type `A | B` represents an entity that is either of type `A` or type `B`, whereas an intersection type `A & B` represents an entity that is both of type `A`*and* type `B`.
@@ -105,7 +105,7 @@ abc.c = "hello";
105
105
106
106
See [issue #1256](https://github.com/Microsoft/TypeScript/issues/1256) for more information.
107
107
108
-
# Local type declarations
108
+
##Local type declarations
109
109
110
110
Local class, interface, enum, and type alias declarations can now appear inside function declarations. Local types are block scoped, similar to variables declared with `let` and `const`. For example:
111
111
@@ -165,7 +165,7 @@ function f3() {
165
165
}
166
166
```
167
167
168
-
# Class expressions
168
+
##Class expressions
169
169
170
170
TypeScript 1.6 adds support for ES6 class expressions. In a class expression, the class name is optional and, if specified, is only in scope in the class expression itself. This is similar to the optional name of a function expression. It is not possible to refer to the class instance type of a class expression outside the class expression, but the type can of course be matched structurally. For example:
171
171
@@ -180,7 +180,7 @@ var p = new Point(3, 4); // p has anonymous class type
180
180
console.log(p.length());
181
181
```
182
182
183
-
# Extending expressions
183
+
##Extending expressions
184
184
185
185
TypeScript 1.6 adds support for classes extending arbitrary expression that computes a constructor function. This means that built-in types can now be extended in class declarations.
186
186
@@ -223,7 +223,7 @@ class Test extends getGreeterBase() {
223
223
}
224
224
```
225
225
226
-
# `abstract` classes and methods
226
+
##`abstract` classes and methods
227
227
228
228
TypeScript 1.6 adds support for `abstract` keyword for classes and their methods. An abstract class is allowed to have methods with no implementation, and cannot be constructed.
229
229
@@ -253,7 +253,7 @@ y.getThing(); // OK
253
253
y.getOtherThing(); // OK
254
254
```
255
255
256
-
# Generic type aliases
256
+
##Generic type aliases
257
257
258
258
With TypeScript 1.6, type aliases can be generic. For example:
259
259
@@ -272,7 +272,7 @@ interface Tuple<A, B> {
272
272
typePair<T> =Tuple<T, T>;
273
273
```
274
274
275
-
# Stricter object literal assignment checks
275
+
##Stricter object literal assignment checks
276
276
277
277
TypeScript 1.6 enforces stricter object literal assignment checks for the purpose of catching excess or misspelled properties. Specifically, when a fresh object literal is assigned to a variable or passed as an argument for a non-empty target type, it is an error for the object literal to specify properties that don't exist in the target type.
278
278
@@ -293,7 +293,7 @@ var x: { foo: number, [x: string]: any };
293
293
x= { foo: 1, baz: 2 }; // Ok, `baz` matched by index signature
294
294
```
295
295
296
-
# ES6 generators
296
+
##ES6 generators
297
297
298
298
TypeScript 1.6 adds support for generators when targeting ES6.
299
299
@@ -320,7 +320,7 @@ function *g() {
320
320
}
321
321
```
322
322
323
-
# Experimental support for `async` functions
323
+
##Experimental support for `async` functions
324
324
325
325
TypeScript 1.6 introduces experimental support of `async` functions when targeting ES6.
326
326
Async functions are expected to invoke an asynchronous operation and await its result without blocking normal execution of the program.
@@ -358,15 +358,15 @@ class C {
358
358
}
359
359
```
360
360
361
-
# Nightly builds
361
+
##Nightly builds
362
362
363
363
While not strictly a language change, nightly builds are now available by installing with the following command:
364
364
365
365
```Shell
366
366
npm install -g typescript@next
367
367
```
368
368
369
-
# Adjustments in module resolution logic
369
+
##Adjustments in module resolution logic
370
370
371
371
Starting from release 1.6 TypeScript compiler will use different set of rules to resolve module names when targeting 'commonjs'.
372
372
These [rules](https://github.com/Microsoft/TypeScript/issues/2338) attempted to model module lookup procedure used by Node.
@@ -376,7 +376,7 @@ User however can override module resolution rules picked by the compiler by usin
376
376
* 'classic' - module resolution rules used by pre 1.6 TypeScript compiler
377
377
* 'node' - node-like module resolution
378
378
379
-
# Merging ambient class and interface declaration
379
+
##Merging ambient class and interface declaration
380
380
381
381
The instance side of an ambient class declaration can be extended using an interface declaration The class constructor object is unmodified.
382
382
For example:
@@ -396,7 +396,7 @@ function bar(foo : Foo) {
396
396
}
397
397
```
398
398
399
-
# User-defined type guard functions
399
+
##User-defined type guard functions
400
400
401
401
TypeScript 1.6 adds a new way to narrow a variable type inside an `if` block, in addition to `typeof` and `instanceof`.
402
402
A user-defined type guard functions is one with a return type annotation of the form `x is T`, where `x` is a declared parameter in the signature, and `T` is any type.
@@ -415,7 +415,7 @@ if(isCat(x)) {
415
415
}
416
416
```
417
417
418
-
# `exclude` property support in tsconfig.json
418
+
##`exclude` property support in tsconfig.json
419
419
420
420
A tsconfig.json file that doesn't specify a files property (and therefore implicitly references all *.ts files in all subdirectories) can now contain an exclude property that specifies a list of files and/or directories to exclude from the compilation.
421
421
The exclude property must be an array of strings that each specify a file or folder name relative to the location of the tsconfig.json file.
@@ -436,7 +436,7 @@ For example:
436
436
437
437
The `exclude` list does not support wilcards. It must simply be a list of files and/or directories.
438
438
439
-
# `--init` command line option
439
+
##`--init` command line option
440
440
441
441
Run `tsc --init` in a directory to create an initial `tsconfig.json` in this directory with preset defaults.
442
-
Optionally pass command line arguments along with `--init` to be stored in your initial tsconfig.json on creation.
442
+
Optionally pass command line arguments along with `--init` to be stored in your initial tsconfig.json on creation.
0 commit comments