Skip to content

Commit 57a0c7c

Browse files
authored
Merge pull request #1 from basarat/master
pull upstream
2 parents b9c8cf3 + 446b677 commit 57a0c7c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+743
-215
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ I've been looking at the issues that turn up commonly when people start using Ty
2727
* Thank you for writing TypeScript Deep Dive. I have learned so much. [link](https://twitter.com/buctwbzs/status/857198618704355328?refsrc=email&s=11)
2828
* Loving @basarat's @typescriptlang online book basarat.gitbooks.io/typescript/# loaded with great recipes! [link](https://twitter.com/ericliprandi/status/857608837309677568)
2929
* Microsoft doc is great already, but if want to "dig deeper" into TypeScript I find this book of great value [link](https://twitter.com/caludio/status/876729910550831104)
30+
* Thanks, this is a great book 🤓🤓 [link](https://twitter.com/jjwonmin/status/885666375548547073)
31+
* Deep dive to typescript is awesome in so many levels. i find it very insightful. Thanks [link](https://twitter.com/orenmizr/status/891083492787970053)
3032

3133
## Get Started
3234
If you are here to read the book online [get started](http://basarat.gitbooks.io/typescript/content/docs/getting-started.html).

SUMMARY.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
* [Getting Started](docs/getting-started.md)
44
* [Why TypeScript](docs/why-typescript.md)
55
* [JavaScript](docs/javascript/recap.md)
6-
* [Awful](docs/javascript/awful.md)
6+
* [Equality](docs/javascript/equality.md)
7+
* [References](docs/javascript/references.md)
8+
* [Null vs. Undefined](docs/javascript/null-undefined.md)
9+
* [this](docs/javascript/this.md)
710
* [Closure](docs/javascript/closure.md)
11+
* [Number](docs/javascript/number.md)
812
* [Future JavaScript Now](docs/future-javascript.md)
913
* [Classes](docs/classes.md)
1014
* [Classes Emit](docs/classes-emit.md)
1115
* [Classes Super](docs/classes-super.md)
12-
* [Classes Extensibility](docs/classes-extensibility-wip.md)
1316
* [Arrow Functions](docs/arrow-functions.md)
1417
* [Rest Parameters](docs/rest-parameters.md)
1518
* [let](docs/let.md)
@@ -31,7 +34,8 @@
3134
* [File Module Details](docs/project/external-modules.md)
3235
* [globals.d.ts](docs/project/globals.md)
3336
* [Namespaces](docs/project/namespaces.md)
34-
* [NodeJS QuickStart](docs/quick/nodejs.md)
37+
* [Dynamic Import Expressions](docs/project/dynamic-import-expressions.md)
38+
* [Node.js QuickStart](docs/quick/nodejs.md)
3539
* [Browser QuickStart](docs/quick/browser.md)
3640
* [TypeScript's Type System](docs/types/type-system.md)
3741
* [JS Migration Guide](docs/types/migrating.md)
@@ -43,6 +47,7 @@
4347
* [Enums](docs/enums.md)
4448
* [`lib.d.ts`](docs/types/lib.d.ts.md)
4549
* [Functions](docs/types/functions.md)
50+
* [Callable](docs/types/callable.md)
4651
* [Type Assertion](docs/types/type-assertion.md)
4752
* [Freshness](docs/types/freshness.md)
4853
* [Type Guard](docs/types/typeGuard.md)
@@ -82,7 +87,7 @@
8287
* [Build Toggles](docs/tips/build-toggles.md)
8388
* [Barrel](docs/tips/barrel.md)
8489
* [Create Arrays](docs/tips/create-arrays.md)
85-
* [Promise Safety](docs/tips/promise-safety.md)
90+
* [Typesafe Event Emitter](docs/tips/typed-event.md)
8691
* [StyleGuide](docs/styleguide/styleguide.md)
8792
* [Common Errors](docs/errors/main.md)
8893
* [TypeScript Compiler Internals](docs/compiler/overview.md)

book.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
{
2-
"gitbook": ">=3.2.1",
3-
"plugins": ["edit-link", "github"],
2+
"plugins": ["edit-link", "github", "adsense","header"],
43
"pluginsConfig": {
4+
"layout": {
5+
"headerPath" : "header.html"
6+
},
7+
"lunr": {
8+
"ignoreSpecialCharacters": true
9+
},
510
"edit-link": {
611
"base": "https://github.com/basarat/typescript-book/tree/master",
712
"label": "Edit This Page"
813
},
914
"github": {
1015
"url": "https://github.com/basarat/typescript-book/"
16+
},
17+
"adsense": {
18+
"client": "ca-pub-4656761253552116",
19+
"slot": "2017468453",
20+
"format": "auto",
21+
"element": ".page-inner section",
22+
"position": "bottom"
1123
}
1224
}
1325
}

code/async-await/es5/asyncAwaitES5.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function delay(milliseconds, count) {
4040
}, milliseconds);
4141
});
4242
}
43-
// async function allways return a Promise
43+
// async function always return a Promise
4444
function dramaticWelcome() {
4545
return __awaiter(this, void 0, void 0, function () {
4646
var i, count;

code/async-await/es5/asyncAwaitES5.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function delay(milliseconds: number, count: number): Promise<number> {
66
});
77
}
88

9-
// async function allways return a Promise
9+
// async function always return a Promise
1010
async function dramaticWelcome(): Promise<void> {
1111
console.log("Hello");
1212

code/async-await/es6/asyncAwaitES6.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function delay(milliseconds, count) {
1313
}, milliseconds);
1414
});
1515
}
16-
// async function allways return a Promise
16+
// async function always return a Promise
1717
function dramaticWelcome() {
1818
return __awaiter(this, void 0, void 0, function* () {
1919
console.log("Hello");

code/async-await/es6/asyncAwaitES6.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function delay(milliseconds: number, count: number): Promise<number> {
66
});
77
}
88

9-
// async function allways return a Promise
9+
// async function always return a Promise
1010
async function dramaticWelcome(): Promise<void> {
1111
console.log("Hello");
1212

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"use strict";
2+
function myApp() {
3+
import(/* webpackChunkName: "momentjs" */ "moment")
4+
.then(function (moment) {
5+
// lazyModule has all of the proper types, autocomplete works,
6+
// type checking works, code references work \o/
7+
var time = moment().format();
8+
console.log("TypeScript >= 2.4.0 Dynamic Import Expression:");
9+
console.log(time);
10+
})
11+
.catch(function (err) {
12+
console.log("Failed to load moment", err);
13+
});
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
function myApp() {
3+
import(/* webpackChunkName: "momentjs" */ "moment")
4+
.then((moment) => {
5+
// lazyModule has all of the proper types, autocomplete works,
6+
// type checking works, code references work \o/
7+
const time = moment().format();
8+
console.log("TypeScript >= 2.4.0 Dynamic Import Expression:");
9+
console.log(time);
10+
})
11+
.catch((err) => {
12+
console.log("Failed to load moment", err);
13+
});
14+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "dynamic-import-expressions",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "dynamicImportExpression.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "Jose Quinto Zamora - https://blog.josequinto.com",
10+
"license": "ISC",
11+
"devDependencies": {
12+
"typescript": "^2.4.1"
13+
},
14+
"dependencies": {
15+
"moment": "^2.18.1"
16+
}
17+
}

0 commit comments

Comments
 (0)