Skip to content
Open
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/frontend-knowledge/typescript/basic-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const arr2: Array<string> = [];

### 元组

在某些情况下,使用元组(Tuple)来代替数组要更加妥当,比如一个数组中只存放固定长度的变量,但我们进行了超出长度的访问。如果是数组,会抛出错误;使用元素的话,能在越界访问时给出类型报错:
在某些情况下,使用元组(Tuple)来代替数组要更加妥当,比如一个数组中只存放固定长度的变量,但我们进行了超出长度的访问。如果是数组,会抛出错误;使用元组的话,能在越界访问时给出类型报错:

```typescript
// 使用数组,运行时报错
Expand Down