Type Parameter

Noun · Development

Definitions

  1. A placeholder type variable declared in angle brackets (e.g., `<T>`) on a generic function, class, or interface that is replaced with a concrete type when the generic is instantiated. It enables writing code that works uniformly over many types while preserving type safety — `Array<T>` becomes `Array<string>` or `Array<number>` at the call site.

    In plain English: A placeholder letter (like T) in generic code that gets filled in with an actual type when the code is used.

    Example: "The function takes a type parameter T so it can return the same type it receives — no downcasting needed."

Related Terms