# Can you use the \`where\` keyword with typealias? If so, how?

**URL:** <https://discuss.kotlinlang.org/t/can-you-use-the-where-keyword-with-typealias-if-so-how/11921>\
**Category:** Uncategorized\
**Created:** [March 11, 2019, 6:53pm UTC](https://discuss.kotlinlang.org/t/can-you-use-the-where-keyword-with-typealias-if-so-how/11921 "2019-03-11T18:53:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TrombaMarina](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/trombamarina/32/2092_2.png) [@TrombaMarina](https://discuss.kotlinlang.org/u/TrombaMarina)\
**Post date:** [March 11, 2019, 6:53pm UTC](https://discuss.kotlinlang.org/t/can-you-use-the-where-keyword-with-typealias-if-so-how/11921/1 "2019-03-11T18:53:32Z")

</div>

I just learned that Kotlin supports generic intersection types with the `where` keyword as in:

```kotlin
interface TwoPhase
interface Ac120V

fun <T> foo(ac: T) where T : TwoPhase, T: Ac120V {
    // do stuff...
}

```

Now I’m wondering if you can make a typealias for an intersection (or union) type? I don’t know. I expected to be able to do something like:

```kotlin
typealias Not3Phase = <T> where T : TwoPhase, T: Ac120V

```

or

```kotlin
typealias Not3Phase = TwoPhase & Ac120V

```

If there’s a way to do this, it’s not obvious to me.

---

<div class="post-metadata">

**Author:** ![TrombaMarina](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/trombamarina/32/2092_2.png) [@TrombaMarina](https://discuss.kotlinlang.org/u/TrombaMarina)\
**Post date:** [March 13, 2019, 3:37pm UTC](https://discuss.kotlinlang.org/t/can-you-use-the-where-keyword-with-typealias-if-so-how/11921/2 "2019-03-13T15:37:47Z")

</div>

I think I figured this out. The answer is “No” and the reason is because that’s what Interfaces do. The correct syntax (works today) is:

```kotlin
interface Not3Phase : TwoPhase, Ac120V

```

---

<div class="post-metadata">

**Author:** ![fatjoe79](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/fatjoe79/32/4221_2.png) [@fatjoe79](https://discuss.kotlinlang.org/u/fatjoe79)\
**Post date:** [March 13, 2019, 8:48pm UTC](https://discuss.kotlinlang.org/t/can-you-use-the-where-keyword-with-typealias-if-so-how/11921/3 "2019-03-13T20:48:08Z")

</div>

I waited for you to find this out for yourself 😉

Just kidding. I assumed it, but I couldn’t answer, because the union / intersection miscommunication confused me.
