Type Parameters
What
TypeScript offers an alternative way to declare arrays using generic type parameter syntax: Array<T>.
How
This syntax is functionally identical to the T[] notation. Both of these declarations are valid and mean the same thing:
// Bracket notation
const colors: string[] = ["blue", "green"];
// Generic type parameter syntax
const counts: Array<number> = [1000, 5000];
Why
While T[] is more concise and commonly preferred for simple arrays, Array<T> is useful for maintaining consistency when working with other generic types. It explicitly signals that an Array is a generic container for a specific type.
Summary
Choose the syntax that best fits your project’s style guide; T[] is generally favored for its brevity.