Skip to content

fix: typo #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 19, 2023
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
2 changes: 1 addition & 1 deletion docs/enum.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ enum Color {
}
```

上面示例声明了一个 Enum 结构`Color`,里面包含三个成员`Red`、`Green`和`Blue`。第一个成员的值默认为整数`0`,第二个为`1`,第二个为`2`,以此类推。
上面示例声明了一个 Enum 结构`Color`,里面包含三个成员`Red`、`Green`和`Blue`。第一个成员的值默认为整数`0`,第二个为`1`,第三个为`2`,以此类推。

使用时,调用 Enum 的某个成员,与调用对象属性的写法一样,可以使用点运算符,也可以使用方括号运算符。

Expand Down
2 changes: 1 addition & 1 deletion docs/generics.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ foo.add = function (x, y) {
};
```

上面示例中,先新建类`C`的实例`foo`,然后再定义示例的`value`属性和`add()`方法。类的定义中,属性和方法后面的感叹号是非空断言,告诉 TypeScript 它们都是非空的,后面会赋值。
上面示例中,先新建类`C`的实例`foo`,然后再定义实例的`value`属性和`add()`方法。类的定义中,属性和方法后面的感叹号是非空断言,告诉 TypeScript 它们都是非空的,后面会赋值。

JavaScript 的类本质上是一个构造函数,因此也可以把泛型类写成构造函数。

Expand Down