Which of the following is a correct example of a generic function?
function identity<T>(value: T): T {
return value;
}
The function uses a generic type <T> for flexibility.
<T> is unnecessary and makes the function invalid.
The identity function is not generic.
The identity function must define a fixed type for T.
This question is part of this quiz :
Generics in TypeScript Quiz