I can't get my head arround the following paragraph in the TypeScript documentation:
"The type of generic functions is just like those of non-generic functions, with the type parameters listed first, similarly to function declarations:"
function identity<T>(arg: T): T {
return arg;
}
let myIdentity: <T>(arg: T) => T = identity;
What does the last line do and why is it used?
As far as I understood, myIdentity is a variable which gets the type of the identity function? And if this is the case why do I need to define such a variable? The function identity already declares what return type I can expect.