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: docs/types/generics.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,7 @@ queue.push("1"); // ERROR : cannot push a string. Only numbers allowed
53
53
// ^ if that error is fixed the rest would be fine too
54
54
```
55
55
56
-
Of course this can quickly become painful e.g. if you want a string queue you have to go through all that effort again. What you really want is a way to say that whatever the type is of the stuff getting *pushed* it should be the same for whatever gets *poped*. This is done easily with a *generic* parameter (in this case on the class):
56
+
Of course this can quickly become painful e.g. if you want a string queue you have to go through all that effort again. What you really want is a way to say that whatever the type is of the stuff getting *pushed* it should be the same for whatever gets *popped*. This is done easily with a *generic* parameter (in this case, at the class level):
57
57
58
58
```ts
59
59
/** A class definition with a generic parameter */
@@ -172,9 +172,9 @@ declare function require(name: string): any;
This is just an example, if you are considering on using this `require` typings you don't need to cause:
175
+
This is just an example; if you are considering on using this `require` typings, you don't need to because:
176
176
177
-
1. It's already there in `node.d.ts` you can install using `npm install @types/node --save-dev`.
177
+
1. It's already there in `node.d.ts`: you can install using `npm install @types/node --save-dev`.
178
178
1. You should consider using the type definitions for your library e.g. for jquery `npm install @types/jquery --save-dev` instead of using raw `require`.
0 commit comments