Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 58e3691

Browse files
doggy8088gitbook-bot
authored andcommitted
GitBook: [master] 31 pages and 8 assets modified
1 parent f94ef45 commit 58e3691

34 files changed

+631
-717
lines changed

README.md

Lines changed: 52 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,54 @@
1-
# TypeScript 新手入門 (正體中文版)
1+
# 前言
22

33
從 JavaScript 程式設計師的角度總結思考,循序漸進的理解 TypeScript。
44

55
## 正體中文翻譯
66

77
本書 [TypeScript 新手指南](https://willh.gitbook.io/typescript-tutorial/) 的原文來自於簡體中文的 [TypeScript 入门教程](https://github.com/xcatliu/typescript-tutorial/) 專案,並將其內容翻譯為正體中文版。如有正體中文翻譯不妥的地方,歡迎發 [Issue](https://github.com/doggy8088/typescript-tutorial/issues) 給我,或到 [Will 保哥的技術交流中心](https://www.facebook.com/will.fans/) 粉絲團留言給我,謝謝!🙂
88

9-
---
10-
119
## 關於本書
1210

13-
- [線上閱讀](https://ts.xcatliu.com/)(部署在 [GitBook](https://www.gitbook.com/book/xcatliu/typescript-tutorial/details) 上,可能需要翻牆)
14-
- [線上閱讀(GitHub 版)](https://github.com/xcatliu/typescript-tutorial/blob/master/README.md)
15-
- [GitHub 地址][GitHub]
16-
- 作者:[xcatliu](https://github.com/xcatliu/)
17-
- 官方 QQ 群:[加入 QQ 群 767142358](https://jq.qq.com/?_wv=1027&k=5nkkFCl)
11+
* [線上閱讀](https://ts.xcatliu.com/)(部署在 [GitBook](https://www.gitbook.com/book/xcatliu/typescript-tutorial/details) 上,可能需要翻牆)
12+
* [線上閱讀(GitHub 版)](https://github.com/xcatliu/typescript-tutorial/blob/master/README.md)
13+
* [GitHub 地址](https://github.com/xcatliu/typescript-tutorial)
14+
* 作者:[xcatliu](https://github.com/xcatliu/)
15+
* 官方 QQ 群:[加入 QQ 群 767142358](https://jq.qq.com/?_wv=1027&k=5nkkFCl)
1816

19-
本書是作者在學習 [TypeScript] 後整理的學習筆記。
17+
本書是作者在學習 [TypeScript](http://www.typescriptlang.org/) 後整理的學習筆記。
2018

21-
隨著對 TypeScript 理解的加深和 TypeScript 社群的發展,本書也會做出相應的更新,歡迎大家 [Star 收藏][GitHub]
19+
隨著對 TypeScript 理解的加深和 TypeScript 社群的發展,本書也會做出相應的更新,歡迎大家 [Star 收藏](https://github.com/xcatliu/typescript-tutorial)
2220

23-
- 發現文章內容有問題,可以直接在頁面下方評論
24-
- 對專案的建議,可以[提交 issue](https://github.com/xcatliu/typescript-tutorial/issues/new) 向作者反饋
25-
- 歡迎直接提交 pull-request 參與貢獻
21+
* 發現文章內容有問題,可以直接在頁面下方評論
22+
* 對專案的建議,可以[提交 issue](https://github.com/xcatliu/typescript-tutorial/issues/new) 向作者反饋
23+
* 歡迎直接提交 pull-request 參與貢獻
2624

2725
## 為什麼要寫本書
2826

29-
TypeScript 雖然有[官方手冊][Handbook]及其[非官方中文版][中文手冊],但是它每一章都希望能詳盡的描述一個概念,導致前面的章節就會包含很多後面才會學習到的內容,而有些本該一開始就瞭解的基礎知識卻在後面才會涉及。如果是初學者,可能需要閱讀多次才能理解。所以它更適合用來查閱,而不是學習。
27+
TypeScript 雖然有[官方手冊](http://www.typescriptlang.org/docs/handbook/basic-types.html)及其[非官方中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/),但是它每一章都希望能詳盡的描述一個概念,導致前面的章節就會包含很多後面才會學習到的內容,而有些本該一開始就瞭解的基礎知識卻在後面才會涉及。如果是初學者,可能需要閱讀多次才能理解。所以它更適合用來查閱,而不是學習。
3028

3129
與官方手冊不同,本書著重於從 JavaScript 程式設計師的角度總結思考,循序漸進的理解 TypeScript,希望能給大家一些幫助和啟示。
3230

3331
由於一些知識點與官方手冊重合度很高,本書會在相應章節推薦直接閱讀中文手冊。
3432

3533
## 關於 TypeScript
3634

37-
[TypeScript] 是 JavaScript 的一個超集,主要提供了**型別系統****對 ES6 的支援**,它由 Microsoft 開發,程式碼[開源於 GitHub](https://github.com/Microsoft/TypeScript) 上。
35+
[TypeScript](http://www.typescriptlang.org/) 是 JavaScript 的一個超集,主要提供了**型別系統****對 ES6 的支援**,它由 Microsoft 開發,程式碼[開源於 GitHub](https://github.com/Microsoft/TypeScript) 上。
3836

3937
它的第一個版本釋出於 2012 年 10 月,經歷了多次更新後,現在已成為前端社群中不可忽視的力量,不僅在 Microsoft 內部得到廣泛運用,而且 Google 的 [Angular2](https://angular.io/) 也使用了 TypeScript 作為開發語言。
4038

4139
## 適合人群
4240

4341
本書適合以下人群
4442

45-
- 熟悉 JavaScript,至少閱讀過一遍[《JavaScript 高階程式設計》](https://book.douban.com/subject/10546125/)
46-
- 瞭解 ES6,推薦閱讀 [ECMAScript 6 入門]
47-
- 瞭解 Node.js,會用 npm 安裝及使用一些工具
48-
- 想了解 TypeScript 或者想對 TypeScript 有更深的理解
43+
* 熟悉 JavaScript,至少閱讀過一遍[《JavaScript 高階程式設計》](https://book.douban.com/subject/10546125/)
44+
* 瞭解 ES6,推薦閱讀 [ECMAScript 6 入門](http://es6.ruanyifeng.com/)
45+
* 瞭解 Node.js,會用 npm 安裝及使用一些工具
46+
* 想了解 TypeScript 或者想對 TypeScript 有更深的理解
4947

5048
本書**不適合**以下人群
5149

52-
- 沒有系統學習過 JavaScript
53-
- 已經能夠很熟練的運用 TypeScript
50+
* 沒有系統學習過 JavaScript
51+
* 已經能夠很熟練的運用 TypeScript
5452

5553
## 評價
5654

@@ -60,35 +58,35 @@ TypeScript 雖然有[官方手冊][Handbook]及其[非官方中文版][中文手
6058
6159
## 目錄
6260

63-
- [前言](README.md)
64-
- [簡介](introduction/README.md)
65-
- [什麼是 TypeScript](introduction/what-is-typescript.md)
66-
- [安裝 TypeScript](introduction/get-typescript.md)
67-
- [Hello TypeScript](introduction/hello-typescript.md)
68-
- [基礎](basics/README.md)
69-
- [原始資料型別](basics/primitive-data-types.md)
70-
- [任意值](basics/any.md)
71-
- [型別推論](basics/type-inference.md)
72-
- [聯合型別](basics/union-types.md)
73-
- [物件的型別——介面](basics/type-of-object-interfaces.md)
74-
- [陣列的型別](basics/type-of-array.md)
75-
- [函式的型別](basics/type-of-function.md)
76-
- [型別斷言](basics/type-assertion.md)
77-
- [宣告檔案](basics/declaration-files.md)
78-
- [內建物件](basics/built-in-objects.md)
79-
- [進階](advanced/README.md)
80-
- [型別別名](advanced/type-aliases.md)
81-
- [字串字面量型別](advanced/string-literal-types.md)
82-
- [元組](advanced/tuple.md)
83-
- [列舉](advanced/enum.md)
84-
- [類別](advanced/class.md)
85-
- [類別與介面](advanced/class-and-interfaces.md)
86-
- [泛型](advanced/generics.md)
87-
- [宣告合併](advanced/declaration-merging.md)
88-
- [擴充套件閱讀](advanced/further-reading.md)
89-
- [工程](engineering/README.md)
90-
- [程式碼檢查](engineering/lint.md)
91-
- [感謝](thanks/README.md)
61+
* [前言](./)
62+
* [簡介](introduction/)
63+
* [什麼是 TypeScript](introduction/what-is-typescript.md)
64+
* [安裝 TypeScript](introduction/get-typescript.md)
65+
* [Hello TypeScript](introduction/hello-typescript.md)
66+
* [基礎](basics/)
67+
* [原始資料型別](basics/primitive-data-types.md)
68+
* [任意值](basics/any.md)
69+
* [型別推論](basics/type-inference.md)
70+
* [聯合型別](basics/union-types.md)
71+
* [物件的型別——介面](basics/type-of-object-interfaces.md)
72+
* [陣列的型別](basics/type-of-array.md)
73+
* [函式的型別](basics/type-of-function.md)
74+
* [型別斷言](basics/type-assertion.md)
75+
* [宣告檔案](basics/declaration-files.md)
76+
* [內建物件](basics/built-in-objects.md)
77+
* [進階](advanced/)
78+
* [型別別名](advanced/type-aliases.md)
79+
* [字串字面量型別](advanced/string-literal-types.md)
80+
* [元組](advanced/tuple.md)
81+
* [列舉](advanced/enum.md)
82+
* [類別](advanced/class.md)
83+
* [類別與介面](advanced/class-and-interfaces.md)
84+
* [泛型](advanced/generics.md)
85+
* [宣告合併](advanced/declaration-merging.md)
86+
* [擴充套件閱讀](advanced/further-reading.md)
87+
* [工程](engineering/)
88+
* [程式碼檢查](engineering/lint.md)
89+
* [感謝](thanks.md)
9290

9391
## 版權許可
9492

@@ -100,16 +98,8 @@ TypeScript 雖然有[官方手冊][Handbook]及其[非官方中文版][中文手
10098

10199
## 相關資料
102100

103-
- [TypeScript 官網][TypeScript]
104-
- [Handbook][中文版][中文手冊]
105-
- [ECMAScript 6 入門]
106-
107-
---
108-
109-
- [下一章:簡介](introduction/README.md)
101+
* [TypeScript 官網](http://www.typescriptlang.org/)
102+
* [Handbook](http://www.typescriptlang.org/docs/handbook/basic-types.html)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/)
103+
* [ECMAScript 6 入門](http://es6.ruanyifeng.com/)
104+
* [下一章:簡介](introduction/)
110105

111-
[GitHub]: https://github.com/xcatliu/typescript-tutorial
112-
[TypeScript]: http://www.typescriptlang.org/
113-
[Handbook]: http://www.typescriptlang.org/docs/handbook/basic-types.html
114-
[中文手冊]: https://zhongsp.gitbooks.io/typescript-handbook/content/
115-
[ECMAScript 6 入門]: http://es6.ruanyifeng.com/

SUMMARY.md

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
1-
# Summary
1+
# Table of contents
2+
3+
* [前言](README.md)
4+
* [簡介](introduction/README.md)
5+
* [什麼是 TypeScript](introduction/what-is-typescript.md)
6+
* [安裝 TypeScript](introduction/get-typescript.md)
7+
* [Hello TypeScript](introduction/hello-typescript.md)
8+
* [基礎](basics/README.md)
9+
* [原始資料型別](basics/primitive-data-types.md)
10+
* [任意值](basics/any.md)
11+
* [型別推論](basics/type-inference.md)
12+
* [聯合型別](basics/union-types.md)
13+
* [物件的型別——介面](basics/type-of-object-interfaces.md)
14+
* [陣列的型別](basics/type-of-array.md)
15+
* [函式的型別](basics/type-of-function.md)
16+
* [型別斷言](basics/type-assertion.md)
17+
* [宣告檔案](basics/declaration-files.md)
18+
* [內建物件](basics/built-in-objects.md)
19+
* [進階](advanced/README.md)
20+
* [型別別名](advanced/type-aliases.md)
21+
* [字串字面量型別](advanced/string-literal-types.md)
22+
* [元組](advanced/tuple.md)
23+
* [列舉](advanced/enum.md)
24+
* [類別](advanced/class.md)
25+
* [類別與介面](advanced/class-and-interfaces.md)
26+
* [泛型](advanced/generics.md)
27+
* [宣告合併](advanced/declaration-merging.md)
28+
* [擴充套件閱讀](advanced/further-reading.md)
29+
* [工程](engineering/README.md)
30+
* [程式碼檢查](engineering/lint.md)
31+
* [感謝](thanks.md)
232

3-
- [前言](README.md)
4-
- [簡介](introduction/README.md)
5-
- [什麼是 TypeScript](introduction/what-is-typescript.md)
6-
- [安裝 TypeScript](introduction/get-typescript.md)
7-
- [Hello TypeScript](introduction/hello-typescript.md)
8-
- [基礎](basics/README.md)
9-
- [原始資料型別](basics/primitive-data-types.md)
10-
- [任意值](basics/any.md)
11-
- [型別推論](basics/type-inference.md)
12-
- [聯合型別](basics/union-types.md)
13-
- [物件的型別——介面](basics/type-of-object-interfaces.md)
14-
- [陣列的型別](basics/type-of-array.md)
15-
- [函式的型別](basics/type-of-function.md)
16-
- [型別斷言](basics/type-assertion.md)
17-
- [宣告檔案](basics/declaration-files.md)
18-
- [內建物件](basics/built-in-objects.md)
19-
- [進階](advanced/README.md)
20-
- [型別別名](advanced/type-aliases.md)
21-
- [字串字面量型別](advanced/string-literal-types.md)
22-
- [元組](advanced/tuple.md)
23-
- [列舉](advanced/enum.md)
24-
- [類別](advanced/class.md)
25-
- [類別與介面](advanced/class-and-interfaces.md)
26-
- [泛型](advanced/generics.md)
27-
- [宣告合併](advanced/declaration-merging.md)
28-
- [擴充套件閱讀](advanced/further-reading.md)
29-
- [工程](engineering/README.md)
30-
- [程式碼檢查](engineering/lint.md)
31-
- [感謝](thanks/README.md)

advanced/README.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
## 進階
1+
# 進階
22

33
本部分介紹一些進階的型別與技術,具體內容包括:
44

5-
- [型別別名](type-aliases.md)
6-
- [字串字面量型別](string-literal-types.md)
7-
- [元組](tuple.md)
8-
- [列舉](enum.md)
9-
- [類別](class.md)
10-
- [類別與介面](class-and-interfaces.md)
11-
- [泛型](generics.md)
12-
- [宣告合併](declaration-merging.md)
13-
- [擴充套件閱讀](further-reading.md)
5+
* [型別別名](type-aliases.md)
6+
* [字串字面量型別](string-literal-types.md)
7+
* [元組](tuple.md)
8+
* [列舉](enum.md)
9+
* [類別](class.md)
10+
* [類別與介面](class-and-interfaces.md)
11+
* [泛型](generics.md)
12+
* [宣告合併](declaration-merging.md)
13+
* [擴充套件閱讀](further-reading.md)
14+
* [上一章:內建物件](https://github.com/doggy8088/typescript-tutorial/tree/3e6aae02f8c2fc9db956b346556647eb1d3cdbe3/advanced/built-in-objects.md)
15+
* [下一章:型別別名](type-aliases.md)
1416

15-
---
16-
17-
- [上一章:內建物件](built-in-objects.md)
18-
- [下一章:型別別名](type-aliases.md)

advanced/class-and-interfaces.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
舉例來說,門是一個類別,防盜門是門的子類別。如果防盜門有一個報警器的功能,我們可以簡單的給防盜門新增一個報警方法。這時候如果有另一個類別,車,也有報警器的功能,就可以考慮把報警器提取出來,作為一個介面,防盜門和車都去實現它:
1212

13-
```ts
13+
```typescript
1414
interface Alarm {
1515
alert();
1616
}
@@ -33,7 +33,7 @@ class Car implements Alarm {
3333

3434
一個類別可以實現多個介面:
3535

36-
```ts
36+
```typescript
3737
interface Alarm {
3838
alert();
3939
}
@@ -62,7 +62,7 @@ class Car implements Alarm, Light {
6262

6363
介面與介面之間可以是繼承關係:
6464

65-
```ts
65+
```typescript
6666
interface Alarm {
6767
alert();
6868
}
@@ -79,7 +79,7 @@ interface LightableAlarm extends Alarm {
7979

8080
介面也可以繼承類別:
8181

82-
```ts
82+
```typescript
8383
class Point {
8484
x: number;
8585
y: number;
@@ -96,7 +96,7 @@ let point3d: Point3d = {x: 1, y: 2, z: 3};
9696

9797
[之前學習過](../basics/type-of-function.md#介面中函式的定義),可以使用介面的方式來定義一個函式需要符合的形狀:
9898

99-
```ts
99+
```typescript
100100
interface SearchFunc {
101101
(source: string, subString: string): boolean;
102102
}
@@ -109,7 +109,7 @@ mySearch = function(source: string, subString: string) {
109109

110110
有時候,一個函式還可以有自己的屬性和方法:
111111

112-
```ts
112+
```typescript
113113
interface Counter {
114114
(start: number): string;
115115
interval: number;
@@ -131,9 +131,7 @@ c.interval = 5.0;
131131

132132
## 參考
133133

134-
- [Interfaces](http://www.typescriptlang.org/docs/handbook/interfaces.html)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Interfaces.html)
134+
* [Interfaces](http://www.typescriptlang.org/docs/handbook/interfaces.html)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Interfaces.html)
135+
* [上一章:類別](class.md)
136+
* [下一章:泛型](generics.md)
135137

136-
---
137-
138-
- [上一章:類別](class.md)
139-
- [下一章:泛型](generics.md)

0 commit comments

Comments
 (0)