# Type Argument

DevFeed: [Type Argument](<https://devfeed.tech/articles/type-argument-25024.md>)

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

Author: author@typealias.com (Dave Leeds)

Published: 2018-01-10T02:43:41Z

Content type: article

Language: en

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

Topics: [generic programming](<https://devfeed.tech/topics/generic-programming.md>), [Type Argument](<https://devfeed.tech/topics/type-argument.md>), [Type Parameter](<https://devfeed.tech/topics/type-parameter.md>), [Use-Site Variance](<https://devfeed.tech/topics/use-site-variance.md>), [Type Projection](<https://devfeed.tech/topics/type-projection.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [generic](<https://devfeed.tech/tags/generic.md>), [invariant](<https://devfeed.tech/tags/invariant.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [programming](<https://devfeed.tech/tags/programming.md>), [type-argument](<https://devfeed.tech/tags/type-argument.md>), [type-parameter](<https://devfeed.tech/tags/type-parameter.md>), [type-projection](<https://devfeed.tech/tags/type-projection.md>), [values](<https://devfeed.tech/tags/values.md>), [variance](<https://devfeed.tech/tags/variance.md>)

## AI overview

A type argument is the concrete type a caller supplies for a generic's type parameter. It can be written in a variable declaration or on a function call or constructor invocation; a compiler may also infer it from context, which can produce a type different from the one intended, so an explicit argument may be needed. The excerpt also explains that generics are normally invariant: a generic over a subtype is not automatically a subtype of the same generic over its supertype. A variance annotation can create a type projection that accepts different subtype arguments when the code only reads values and does not set them. Type arguments are the supplied types; type parameters are the placeholders.

## Source excerpt

A type argument is a specific type, specified by the calling code, that a generic will use in place of a type parameter. If your generic were a light fixture, then the light bulb that's screwed into that light fixture is the type argument. Just as different kinds of light bulbs can be used in a light fixture's socket, different call sites can each specify a different type argument to use in instances of a generic.