diff --git a/pages/Generics.md b/pages/Generics.md index c9db5e1b3..b3b9b8006 100644 --- a/pages/Generics.md +++ b/pages/Generics.md @@ -268,26 +268,15 @@ loggingIdentity({length: 10, value: 3}); ## Using Type Parameters in Generic Constraints -In some cases, it may be useful to declare a type parameter that is constrained by another type parameter. For example, +You can declare a type parameter that is constrained by another type parameter. For example, ```ts -function find>(n: T, s: U) { // errors because type parameter used in constraint +function find>(n: T, s: U) { // ... } find (giraffe, myAnimals); ``` -You can achieve the pattern above by replacing the type parameter with its constraint. Rewriting the example above, - -```ts -function find(n: T, s: Findable) { - // ... -} -find(giraffe, myAnimals); -``` - -*Note:* The above is not strictly identical, as the return type of the first function could have returned `U`, which the second function pattern does not provide a means to do. - ## Using Class Types in Generics When creating factories in TypeScript using generics, it is necessary to refer to class types by their constructor functions. For example,