Question · JavaScript and React course · Module 12: React and TypeScript
Generics in TypeScript
What does the <T> notation mean in the declaration function getFirst<T>(items: T[]): T?
Answer options
- T is a special type for React forms
- T is a type parameter - a placeholder replaced by a concrete type when used
- T means the function only accepts arrays
- T is a string type constant
You can check the correct answer by solving this task in the CodeWorlds game.