| Start |
|---|
Generic Interfaces Declaring a generic interfaceGeneric interface with multiple type parametersImplementing a generic interfaceImplement it with generic class: Implement it with non generic class: |
Generic Class |
| Type parameters as constraints With TypeScript 1.8 it becomes possible for a type parameter constraint to reference type parameters from the same type parameter list. Previously this was an error. |
| Generics Constraints Simple constraint: More complex constraint: Even more complex: Inline type constraints: |
| Generic Functions In interfaces: In classes: Simple functions: |
| Using generic Classes and Functions: Create generic class instance: Run generic function: Syntax
RemarksThe generic parameters are not available at runtime, they are just for the compile time. This means you can't do something like this: However, class information is still preserved, so you can still test for the type of a variable as you have always been able to: |
Read Article
https://develop.horje.com/learn/1434/reference