# Typealias with generic

**URL:** <https://discuss.kotlinlang.org/t/typealias-with-generic/26480>\
**Category:** Language Design\
**Created:** [March 6, 2023, 1:43pm UTC](https://discuss.kotlinlang.org/t/typealias-with-generic/26480 "2023-03-06T13:43:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![henry86](https://avatars.discourse-cdn.com/v4/letter/h/c2a13f/32.png) [@henry86](https://discuss.kotlinlang.org/u/henry86)\
**Post date:** [March 6, 2023, 1:43pm UTC](https://discuss.kotlinlang.org/t/typealias-with-generic/26480/1 "2023-03-06T13:43:35Z")

</div>

Let’s say I have a class container like this:

`class Container<A,B,C,D,E>`

Then I have a handler like this:

```auto
interface Handler<A,B,C,D,E, Z>{
fun map(c:Container<A,B,C,D,E>):Pair<Z, Container<A,B,C,D,E>>

fun add(c1:Container<A,B,C,D,E>, c2:Container<A,B,C,D,E>):Pair<Z, Container<A,B,C,D,E>>
}

```

Later I want to add another generic to container and handler, let’s call it F.

Or i want to remove B and C from container and handler.

Currently I have to make change at multiple places of the code, but I would like to have an opportunity to change the code not so often.

Like to create a typealias in handler:

`typealias HContainer = Container<A,B,C,D,E>`

So that code would look like this:

```auto
interface Handler<A,B,C,D,E, Z>{
fun map(c:HContainer):Pair<Z, HContainer>>

fun add(c1:HContainer, c2:HContainer):Pair<Z, HContainer>
}

```

But would still be using generics, just not be able to see.

Is there any way to achieve, what I want?
