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 t
The last line declares a variable named myIdentity
. The variable is of a function type, a generic function (the
makes the it the signature of a generic function, more type arguments could be in the list) which takes an argument of type T
and returns a value of typeT
. And then initializes the variable with the identity
function which conforms to the declared signature of myIdentity.
You may want to do this in order to assign different functions to myIdentity
based on runtime conditions. Or declare a parameter of this type and pass it to a function that can invoke it later.