You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: zh/handbook/generics.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -90,7 +90,7 @@ function loggingIdentity<T>(arg: T[]): T[] {
90
90
}
91
91
```
92
92
93
-
你可以这样理解`loggingIdentity`的类型:泛型函数`loggingIdentity`,接收类型参数`T`和参数`arg`,它是个元素类型是`T`的数组,并返回元素类型是`T`的数组。 如果我们传入数字数组,将返回一个数字数组,因为此时`T`的的类型为`number`。 这可以让我们把泛型变量 T 当做类型的一部分使用,而不是整个类型,增加了灵活性。
93
+
你可以这样理解`loggingIdentity`的类型:泛型函数`loggingIdentity`,接收类型参数`T`和参数`arg`,它是个元素类型是`T`的数组,并返回元素类型是`T`的数组。 如果我们传入数字数组,将返回一个数字数组,因为此时`T`的类型为`number`。 这可以让我们把泛型变量 T 当做类型的一部分使用,而不是整个类型,增加了灵活性。
0 commit comments