Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@ TypeScript 提供了控制加宽过程的方法,例如使用"const"。
For example:

```typescript
const x = 'x'; // TypeScript 将 x 的类型推断为 'x',一种较窄的类型
const x = 'x'; // TypeScript 将 'x' 推断为带有 'const'(不可变)的字符串字面量,但将其扩展为带有 'let'(可重新赋值)的 'string'。
let y: 'y' | 'x' = 'y';
y = x; // 有效: x的类型推断为 'x'
```
Expand Down Expand Up @@ -3760,7 +3760,7 @@ type MyType = MyTuple[2]; // boolean

#### Awaited\<T\>

构造一个递归解包 Promise 的类型
构造一个递归解包 Promise 类型的类型

```typescript
type A = Awaited<Promise<string>>; // string
Expand Down Expand Up @@ -4174,7 +4174,7 @@ WebSocket:

### 迭代器和生成器

TypeScript 很好地支持交互器和生成器
TypeScript 对迭代器和生成器都提供了很好的支持

迭代器是实现迭代器协议的对象,提供了一种逐个访问集合或序列元素的方法。它是一个包含指向迭代中下一个元素的指针的结构。他们有一个 `next()` 方法返回序列中的下一个值以及指示序列是否为 的布尔值 `done` 。

Expand Down
Binary file modified downloads/typescript-book-zh_CN.epub
Binary file not shown.
Binary file modified downloads/typescript-book-zh_CN.pdf
Binary file not shown.
Binary file modified downloads/typescript-book.epub
Binary file not shown.
Binary file modified downloads/typescript-book.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion website/src/content/docs/book/others.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ WebSocket:

### Iterators and Generators

Both Interators and Generators are well supported in TypeScript.
Both Iterators and Generators are well supported in TypeScript.

Iterators are objects that implement the iterator protocol, providing a way to access elements of a collection or sequence one by one. It is a structure that contains a pointer to the next element in the iteration. They have a `next()` method that returns the next value in the sequence along with a boolean indicating if the sequence is `done`.

Expand Down
2 changes: 1 addition & 1 deletion website/src/content/docs/book/type-from-value.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ sidebar:
Type from Value in TypeScript refers to the automatic inference of a type from a value or expression through type inference.

```typescript
const x = 'x'; // TypeScript can automatically infer that the type of the message variable is string
const x = 'x'; // TypeScript infers 'x' as a string literal with 'const' (immutable), but widens it to 'string' with 'let' (reassignable).
```

2 changes: 1 addition & 1 deletion website/src/content/docs/book/type-manipulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Several built-in utility types can be used to manipulate types, below a list of

#### Awaited\<T\>

Constructs a type recursively unwrap Promises.
Constructs a type that recursively unwraps Promise types.

```typescript
type A = Awaited<Promise<string>>; // string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ TypeScript 提供了控制加宽过程的方法,例如使用"const"。
For example:

```typescript
const x = 'x'; // TypeScript 将 x 的类型推断为 'x',一种较窄的类型
const x = 'x'; // TypeScript 将 'x' 推断为带有 'const'(不可变)的字符串字面量,但将其扩展为带有 'let'(可重新赋值)的 'string'。
let y: 'y' | 'x' = 'y';
y = x; // 有效: x的类型推断为 'x'
```
Expand Down
2 changes: 1 addition & 1 deletion website/src/content/docs/zh-cn/book/others.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ WebSocket:

### 迭代器和生成器

TypeScript 很好地支持交互器和生成器
TypeScript 对迭代器和生成器都提供了很好的支持

迭代器是实现迭代器协议的对象,提供了一种逐个访问集合或序列元素的方法。它是一个包含指向迭代中下一个元素的指针的结构。他们有一个 `next()` 方法返回序列中的下一个值以及指示序列是否为 的布尔值 `done` 。

Expand Down
2 changes: 1 addition & 1 deletion website/src/content/docs/zh-cn/book/type-manipulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type MyType = MyTuple[2]; // boolean

#### Awaited\<T\>

构造一个递归解包 Promise 的类型
构造一个递归解包 Promise 类型的类型

```typescript
type A = Awaited<Promise<string>>; // string
Expand Down