Created
December 22, 2014 17:57
-
-
Save devdays/75ad091721a4700fdd44 to your computer and use it in GitHub Desktop.
TypeScript generics example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Array<T> { | |
// ... | |
map<U>(callbackfn: (value: T, index: number, array: T[]) => U): U[]; | |
// ... | |
} | |
var array: Array<string> = ["John", "Sam", "George"]; | |
var lengths = array.map((val, idx, arr) => val.length); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment