# Type Parameter

DevFeed: [Type Parameter](<https://devfeed.tech/articles/type-parameter-25027.md>)

Original publisher: [Read original article](<https://typealias.com/concepts/type-parameter/>)

Author: author@typealias.com (Dave Leeds)

Published: 2018-01-04T03:23:40Z

Content type: article

Language: en

Sources: [Dave Leeds on Kotlin - typealias.com](<https://devfeed.tech/sources/dave-leeds-on-kotlin-typealias-com.md>)

Topics: [Type Parameter](<https://devfeed.tech/topics/type-parameter.md>), [generic programming](<https://devfeed.tech/topics/generic-programming.md>), [Type Argument](<https://devfeed.tech/topics/type-argument.md>), [interface](<https://devfeed.tech/topics/interface.md>), [Reified Type Parameter](<https://devfeed.tech/topics/reified-type-parameter.md>)

Tags: [annotation](<https://devfeed.tech/tags/annotation.md>), [class](<https://devfeed.tech/tags/class.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [constraint](<https://devfeed.tech/tags/constraint.md>), [function](<https://devfeed.tech/tags/function.md>), [generic](<https://devfeed.tech/tags/generic.md>), [interface](<https://devfeed.tech/tags/interface.md>), [java](<https://devfeed.tech/tags/java.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [programming](<https://devfeed.tech/tags/programming.md>), [reification](<https://devfeed.tech/tags/reification.md>), [reified-type-parameter](<https://devfeed.tech/tags/reified-type-parameter.md>), [type-parameter](<https://devfeed.tech/tags/type-parameter.md>), [variance](<https://devfeed.tech/tags/variance.md>)

## AI overview

A type parameter is a placeholder for a type chosen by code that uses a generic. It can be declared and referenced in multiple places within a generic function, class, or interface; classes, functions, extension properties, and interfaces can all be generic. Names are conventionally single uppercase letters. Constraints limit which types callers may supply. Generic classes and interfaces do not support subtyping by default, but variance annotations can introduce it while limiting how the type parameter can be used. Reified type parameters can be used to check an object against the parameter's type or obtain a class reference.

## Source excerpt

A type parameter is a placeholder for an actual type, which gets specified by the code that's using the generic. If you imagine your generic as a light fixture, the type parameter would be the socket where the light bulb goes. Just as you can choose from a variety of different light bulbs to put into that socket, the calling code can choose from a variety of different types to pass to a generic.