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

Skip to content

Commit e8bc8a6

Browse files
committed
pagic 0.7.22
1 parent 34f5a25 commit e8bc8a6

32 files changed

+17
-191
lines changed

.github/workflows/gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
export DENO_INSTALL="/home/runner/.deno"
1818
export PATH="$DENO_INSTALL/bin:$PATH"
1919
deno --version
20-
deno install --unstable --allow-read --allow-write --allow-net -n pagic https://deno.land/x/[email protected].19/mod.ts
20+
deno install --unstable --allow-read --allow-write --allow-net -n pagic https://deno.land/x/[email protected].22/mod.ts
2121
pagic build
2222
2323
- name: Deploy

README.md

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
---
2+
next:
3+
text: 简介
4+
link: introduction/index.html
5+
---
6+
17
# TypeScript 入门教程
28

39
[![Actions Status](https://github.com/xcatliu/typescript-tutorial/workflows/gh-pages/badge.svg)](https://github.com/xcatliu/typescript-tutorial/actions)
@@ -7,10 +13,10 @@
713
## 关于本书
814

915
- [在线阅读](https://ts.xcatliu.com/)
10-
- [在线阅读(GitHub 版)](https://github.com/xcatliu/typescript-tutorial/blob/master/README.md)
1116
- [GitHub 地址][GitHub]
1217
- 作者:[xcatliu](https://github.com/xcatliu/)
13-
- 官方 QQ 群:[加入 QQ 群 767142358](https://jq.qq.com/?_wv=1027&k=5nkkFCl)
18+
- [加入官方 QQ 群 767142358](https://jq.qq.com/?_wv=1027&k=5nkkFCl)
19+
- 本网站使用 [Pagic](https://github.com/xcatliu/pagic) 构建
1420

1521
本书是作者在学习 [TypeScript] 后整理的学习笔记。
1622

@@ -54,39 +60,6 @@ TypeScript 虽然有[官方手册][Handbook]及其[非官方中文版][中文手
5460
>
5561
> —— [阮一峰](https://github.com/ruanyf)
5662
57-
## 目录
58-
59-
- [前言](README.md)
60-
- [简介](introduction/README.md)
61-
- [什么是 TypeScript](introduction/what-is-typescript.md)
62-
- [安装 TypeScript](introduction/get-typescript.md)
63-
- [Hello TypeScript](introduction/hello-typescript.md)
64-
- [基础](basics/README.md)
65-
- [原始数据类型](basics/primitive-data-types.md)
66-
- [任意值](basics/any.md)
67-
- [类型推论](basics/type-inference.md)
68-
- [联合类型](basics/union-types.md)
69-
- [对象的类型——接口](basics/type-of-object-interfaces.md)
70-
- [数组的类型](basics/type-of-array.md)
71-
- [函数的类型](basics/type-of-function.md)
72-
- [类型断言](basics/type-assertion.md)
73-
- [声明文件](basics/declaration-files.md)
74-
- [内置对象](basics/built-in-objects.md)
75-
- [进阶](advanced/README.md)
76-
- [类型别名](advanced/type-aliases.md)
77-
- [字符串字面量类型](advanced/string-literal-types.md)
78-
- [元组](advanced/tuple.md)
79-
- [枚举](advanced/enum.md)
80-
- [](advanced/class.md)
81-
- [类与接口](advanced/class-and-interfaces.md)
82-
- [泛型](advanced/generics.md)
83-
- [声明合并](advanced/declaration-merging.md)
84-
- [扩展阅读](advanced/further-reading.md)
85-
- [工程](engineering/README.md)
86-
- [代码检查](engineering/lint.md)
87-
- [编译选项](engineering/compiler-options.md)
88-
- [感谢](thanks/README.md)
89-
9063
## 版权许可
9164

9265
本书采用「保持署名—非商用」创意共享 4.0 许可证。
@@ -101,10 +74,6 @@ TypeScript 虽然有[官方手册][Handbook]及其[非官方中文版][中文手
10174
- [Handbook][中文版][中文手册]
10275
- [ECMAScript 6 入门]
10376

104-
---
105-
106-
- [下一章:简介](introduction/README.md)
107-
10877
[GitHub]: https://github.com/xcatliu/typescript-tutorial
10978
[TypeScript]: http://www.typescriptlang.org/
11079
[Handbook]: http://www.typescriptlang.org/docs/handbook/basic-types.html

advanced/README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,3 @@
1111
- [泛型](generics.md)
1212
- [声明合并](declaration-merging.md)
1313
- [扩展阅读](further-reading.md)
14-
15-
---
16-
17-
- [上一章:内置对象](built-in-objects.md)
18-
- [下一章:类型别名](type-aliases.md)

advanced/class-and-interfaces.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,3 @@ let p2: PointInstanceType;
235235
## 参考
236236

237237
- [Interfaces](http://www.typescriptlang.org/docs/handbook/interfaces.html)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Interfaces.html)
238-
239-
---
240-
241-
- [上一章:类](class.md)
242-
- [下一章:泛型](generics.md)

advanced/class.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,3 @@ console.log(a.sayHi()); // My name is Jack
450450
- [ECMAScript 6 入门 - Class]
451451

452452
[ecmascript 6 入门 - class]: http://es6.ruanyifeng.com/#docs/class
453-
454-
---
455-
456-
- [上一章:枚举](enum.md)
457-
- [下一章:类与接口](class-and-interfaces.md)

advanced/declaration-merging.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,3 @@ interface Alarm {
9595
## 参考
9696

9797
- [Declaration Merging](http://www.typescriptlang.org/docs/handbook/declaration-merging.html)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Declaration%20Merging.html)
98-
99-
---
100-
101-
- [上一章:泛型](generics.md)
102-
- [下一章:扩展阅读](further-reading.md)

advanced/enum.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,3 @@ var directions = [0 /* Up */, 1 /* Down */, 2 /* Left */, 3 /* Right */];
233233

234234
[中文手册 - 枚举]: https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Enums.html
235235
[C# Enum]: https://msdn.microsoft.com/zh-cn/library/sbbt4032.aspx
236-
237-
---
238-
239-
- [上一章:元组](tuple.md)
240-
- [下一章:类](class.md)

advanced/further-reading.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,3 @@
2020
- [Namespaces](http://www.typescriptlang.org/docs/handbook/namespaces.html)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Namespaces.html)):避免全局污染,现在已被 [ES6 Module](http://es6.ruanyifeng.com/#docs/module) 替代
2121
- [Decorators](http://www.typescriptlang.org/docs/handbook/decorators.html)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Decorators.html)):修饰器,这是 [ES7 的一个提案](http://es6.ruanyifeng.com/#docs/decorator)
2222
- [Mixins](http://www.typescriptlang.org/docs/handbook/mixins.html)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Mixins.html)):一种编程模式,与 TypeScript 没有直接关系,可以参考 [ES6 中 Mixin 模式的实现](http://es6.ruanyifeng.com/#docs/class#Mixin模式的实现)
23-
24-
---
25-
26-
- [上一章:声明合并](declaration-merging.md)
27-
- [下一章:工程](../engineering/README.md)

advanced/generics.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,3 @@ function createArray<T = string>(length: number, value: T): Array<T> {
220220

221221
- [Generics](http://www.typescriptlang.org/docs/handbook/generics.html)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/generics.html)
222222
- [Generic parameter defaults](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-3.html#generic-parameter-defaults)
223-
224-
---
225-
226-
- [上一章:类与接口](class-and-interfaces.md)
227-
- [下一章:声明合并](declaration-merging.md)

advanced/string-literal-types.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,3 @@ handleEvent(document.getElementById('world'), 'dblclick'); // 报错,event 不
2323
## 参考
2424

2525
- [Advanced Types # Type Aliases](http://www.typescriptlang.org/docs/handbook/advanced-types.html#string-literal-types)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Advanced%20Types.html#字符串字面量类型)
26-
27-
---
28-
29-
- [上一章:类型别名](type-aliases.md)
30-
- [下一章:元组](tuple.md)

advanced/tuple.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,3 @@ tom.push(true);
6060
## 参考
6161

6262
- [Basic Types # Tuple](http://www.typescriptlang.org/docs/handbook/basic-types.html#tuple)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Basic%20Types.html#元组-tuple)
63-
64-
---
65-
66-
- [上一章:字符串字面量类型](string-literal-types.md)
67-
- [下一章:枚举](enum.md)

advanced/type-aliases.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,3 @@ function getName(n: NameOrResolver): Name {
2424
## 参考
2525

2626
- [Advanced Types # Type Aliases](http://www.typescriptlang.org/docs/handbook/advanced-types.html#type-aliases)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Advanced%20Types.html#类型别名)
27-
28-
---
29-
30-
- [上一章:进阶](../advanced/README.md)
31-
- [下一章:字符串字面量类型](string-literal-types.md)

basics/README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,3 @@
1212
- [类型断言](type-assertion.md)
1313
- [声明文件](declaration-files.md)
1414
- [内置对象](built-in-objects.md)
15-
16-
---
17-
18-
- [上一章:Hello TypeScript](../introduction/hello-typescript.md)
19-
- [下一章:原始数据类型](primitive-data-types.md)

basics/any.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,3 @@ something.setName('Tom');
6666
## 参考
6767

6868
- [Basic Types # Any](http://www.typescriptlang.org/docs/handbook/basic-types.html#any)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Basic%20Types.html#任意值)
69-
70-
---
71-
72-
- [上一章:原始数据类型](primitive-data-types.md)
73-
- [下一章:类型推论](type-inference.md)

basics/built-in-objects.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,3 @@ npm install @types/node --save-dev
103103

104104
[内置对象]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
105105
[TypeScript 核心库的定义文件]: https://github.com/Microsoft/TypeScript/tree/master/src/lib
106-
107-
---
108-
109-
- [上一章:声明文件](declaration-files.md)
110-
- [下一章:进阶](../advanced/README.md)

basics/declaration-files.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,9 +1150,4 @@ pull-request 需要符合它们的规范,并且通过测试,才能被合并
11501150
- [typeRoots or paths](https://github.com/Microsoft/TypeScript/issues/22217#issuecomment-369783776)
11511151
- [DefinitelyTyped][]
11521152

1153-
---
1154-
1155-
- [上一章:类型断言](type-assertion.md)
1156-
- [下一章:内置对象](built-in-objects.md)
1157-
11581153
[DefinitelyTyped]: https://github.com/DefinitelyTyped/DefinitelyTyped/

basics/primitive-data-types.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,6 @@ let num: number = u;
149149
- [ES6 中的二进制和八进制表示法][]
150150
- [ES6 中的模板字符串][]
151151

152-
---
153-
154-
- [上一章:基础](README.md)
155-
- [下一章:任意值](any.md)
156-
157152
[Primitive data types]: https://developer.mozilla.org/en-US/docs/Glossary/Primitive
158153
[ES6 中的新类型 `Symbol`]: http://es6.ruanyifeng.com/#docs/symbol
159154
[ES6 中的二进制和八进制表示法]: http://es6.ruanyifeng.com/#docs/number#二进制和八进制表示法

basics/type-assertion.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -597,10 +597,5 @@ tom.run();
597597
- [Advanced Types # Type Guards and Differentiating Types](http://www.typescriptlang.org/docs/handbook/advanced-types.html#type-guards-and-differentiating-types)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Advanced%20Types.html#类型保护与区分类型(type-guards-and-differentiating-types))
598598
- [TypeScript 的设计理念][]
599599

600-
---
601-
602-
- [上一章:函数的类型](type-of-function.md)
603-
- [下一章:声明文件](declaration-files.md)
604-
605600
[TypeScript 的设计理念]: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
606601
[泛型]: ../advanced/generics.md

basics/type-inference.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,3 @@ myFavoriteNumber = 7;
3535
## 参考
3636

3737
- [Type Inference](http://www.typescriptlang.org/docs/handbook/type-inference.html)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Type%20Inference.html)
38-
39-
---
40-
41-
- [上一章:任意值](any.md)
42-
- [下一章:联合类型](union-types.md)

basics/type-of-array.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,3 @@ let list: any[] = ['xcatliu', 25, { website: 'http://xcatliu.com' }];
114114

115115
- [Basic Types # Array](http://www.typescriptlang.org/docs/handbook/basic-types.html#array)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Basic%20Types.html#数组)
116116
- [Interfaces # Indexable Types](http://www.typescriptlang.org/docs/handbook/interfaces.html#indexable-types)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Interfaces.html#数组类型)
117-
118-
---
119-
120-
- [上一章:对象的类型——接口](type-of-object-interfaces.md)
121-
- [下一章:函数的类型](type-of-function.md)

basics/type-of-function.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,3 @@ function reverse(x: number | string): number | string {
225225
[ES6 中的箭头函数]: http://es6.ruanyifeng.com/#docs/function#箭头函数
226226
[ES6 中函数参数的默认值]: http://es6.ruanyifeng.com/#docs/function#函数参数的默认值
227227
[ES6 中的 rest 参数]: http://es6.ruanyifeng.com/#docs/function#rest参数
228-
229-
---
230-
231-
- [上一章:数组的类型](type-of-array.md)
232-
- [下一章:类型断言](type-assertion.md)

basics/type-of-object-interfaces.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,3 @@ tom.id = 89757;
223223
## 参考
224224

225225
- [Interfaces](http://www.typescriptlang.org/docs/handbook/interfaces.html)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Interfaces.html)
226-
227-
---
228-
229-
- [上一章:联合类型](union-types.md)
230-
- [下一章:数组的类型](type-of-array.md)

basics/union-types.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,3 @@ console.log(myFavoriteNumber.length); // 编译时报错
6464
## 参考
6565

6666
- [Advanced Types # Union Types](http://www.typescriptlang.org/docs/handbook/advanced-types.html#union-types)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Advanced%20Types.html#联合类型)
67-
68-
---
69-
70-
- [上一章:类型推论](type-inference.md)
71-
- [下一章:对象的类型——接口](type-of-object-interfaces.md)

engineering/README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,3 @@
88

99
- [代码检查](lint.md)
1010
- [编译选项](compiler-options.md)
11-
12-
---
13-
14-
- [上一章:扩展阅读](../advanced/further-reading.md)
15-
- [下一章:代码检查](lint.md)

engineering/compiler-options.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,3 @@ import React from 'react';
7474
```
7575

7676
解决办法就是将 `allowSyntheticDefaultImports` 设置为 `true`
77-
78-
---
79-
80-
- [上一章:代码检查](./lint.md)
81-
- [下一章:感谢](../thanks/README.md)

engineering/lint.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,3 @@ npm install --save-dev eslint-plugin-react
443443

444444
[ESLint]: https://eslint.org/
445445
[typescript-eslint]: https://github.com/typescript-eslint/typescript-eslint
446-
447-
---
448-
449-
- [上一章:工程](README.md)
450-
- [下一章:编译选项](./compiler-options.md)

introduction/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
---
2+
previous:
3+
text: TypeScript 入门教程
4+
link: index.html
5+
---
6+
17
# 简介
28

39
本部分介绍了在学习 TypeScript 之前需要了解的知识,具体内容包括:
410

511
- [什么是 TypeScript](what-is-typescript.md)
612
- [安装 TypeScript](get-typescript.md)
713
- [Hello TypeScript](hello-typescript.md)
8-
9-
---
10-
11-
- [上一章:前言](../README.md)
12-
- [下一章:什么是 TypeScript](what-is-typescript.md)

introduction/get-typescript.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,3 @@ TypeScript 最大的优势便是增强了编辑器和 IDE 的功能,包括代
3838
- [Eclipse](https://github.com/palantir/eclipse-typescript)
3939
- [Visual Studio 2015](https://www.microsoft.com/en-us/download/details.aspx?id=48593)
4040
- [Visual Studio 2013](https://www.microsoft.com/en-us/download/details.aspx?id=48739)
41-
42-
---
43-
44-
- [上一章:什么是 TypeScript](what-is-typescript.md)
45-
- [下一章:Hello TypeScript](hello-typescript.md)

introduction/hello-typescript.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,3 @@ console.log(sayHello(user));
6767
**TypeScript 编译的时候即使报错了,还是会生成编译结果**,我们仍然可以使用这个编译之后的文件。
6868

6969
如果要在报错的时候终止 js 文件的生成,可以在 `tsconfig.json` 中配置 `noEmitOnError` 即可。关于 `tsconfig.json`,请参阅[官方手册](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/tsconfig.json.html))。
70-
71-
---
72-
73-
- [上一章:安装 TypeScript](get-typescript.md)
74-
- [下一章:基础](../basics/README.md)

introduction/what-is-typescript.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,3 @@
4848
大家可以根据自己团队和项目的情况判断是否需要使用 TypeScript。
4949

5050
[TypeScript]: http://www.typescriptlang.org/
51-
52-
---
53-
54-
- [上一章:简介](README.md)
55-
- [下一章:安装 TypeScript](get-typescript.md)

pagic.config.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ export default {
77
theme: 'docs',
88
plugins: ['sidebar', 'script', 'gitalk', 'ga'],
99
title: 'TypeScript 入门教程',
10+
description: '从 JavaScript 程序员的角度总结思考,循序渐进的理解 TypeScript。',
11+
github: 'https://github.com/xcatliu/typescript-tutorial',
1012
head: <link rel="icon" type="image/png" href="/favicon.png" />,
1113
nav: [
1214
{
@@ -19,12 +21,6 @@ export default {
1921
<img src="/assets/alipay.jpg" width="256" style={{ verticalAlign: 'top' }} />
2022
</>
2123
)
22-
},
23-
{
24-
text: 'GitHub',
25-
link: 'https://github.com/xcatliu/typescript-tutorial',
26-
target: '_blank',
27-
align: 'right'
2824
}
2925
],
3026
sidebar: [

thanks/README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,3 @@
1212
- 阅读[官方手册](http://www.typescriptlang.org/docs/handbook/basic-types.html)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/))巩固知识
1313
- 阅读 [Project Configuration](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html)[中文版](https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/tsconfig.json.html)) 学习如何配置 TypeScript 工程
1414
- 查看[官方示例](http://www.typescriptlang.org/samples/index.html),学习真实项目
15-
16-
17-
---
18-
19-
- [上一章:代码检查](../engineering/lint.md)

0 commit comments

Comments
 (0)