Skip to content

Commit b66402a

Browse files
committedAug 11, 2023
docs: 去除(), 不然会有理解(|)整体与[]的优先级比较
1 parent 67f37ce commit b66402a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎docs/array.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ let arr:(number|string)[];
2424

2525
上面示例中,数组`arr`的成员类型是`number|string`
2626

27-
这个例子里面的圆括号是必须的,否则因为竖杠`|`的优先级低于`[]`,TypeScript 会把`number|string[]`理解成`number``string[]`的联合类型。
27+
这个例子里面的圆括号是必须的,否则因为竖杠`|`的优先级低于`[]`,TypeScript 会把`number|string[]`理解成`number``string[]`的联合类型。
2828

2929
如果数组成员可以是任意类型,写成`any[]`。当然,这种写法是应该避免的。
3030

0 commit comments

Comments
 (0)
Please sign in to comment.