The typescript handbook currently has nothing on arrow functions. Normal functions
can be generically typed with this syntax:
example:
function identity<T>(arg: T): T {
return arg;
}
What is the syntax for arrow functions?
typescript
The typescript handbook currently has nothing on arrow functions. Normal functions
can be generically typed with this syntax:
example:
function identity<T>(arg: T): T {
return arg;
}
What is the syntax for arrow functions?
Best Answer
The full example explaining the syntax referenced by Robin... brought it home for me:
Generic functions
Something like the following works fine:
However using an arrow generic function will not:
Workaround: Use extends on the generic parameter to hint the compiler that it's a generic, e.g.: