# Multiple types like in TypeScript

**URL:** <https://discuss.kotlinlang.org/t/multiple-types-like-in-typescript/16728>\
**Category:** Language Design\
**Created:** [March 15, 2020, 1:19pm UTC](https://discuss.kotlinlang.org/t/multiple-types-like-in-typescript/16728 "2020-03-15T13:19:30Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![topsys](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/topsys/32/7328_2.png) [@topsys](https://discuss.kotlinlang.org/u/topsys)\
**Post date:** [March 17, 2020, 11:52am UTC](https://discuss.kotlinlang.org/t/multiple-types-like-in-typescript/16728/3 "2020-03-17T11:52:14Z")

</div>

If I think about union types, I think about a “union memory space” where the value is stored in a memory block with the size of the maximum sized element. Was that implemented C or even Pascal (?), I did not remember.

The Multiple types like in TypeScript are just generics helping writing cleaner code that was compiled to Object-Type. The compiler will force the programmer to check each instance of the returned MultiType. In combination with the fabulous smart casting this will create great code.

I will read your mentioned thread, thank you.

---

_[View the full topic](https://discuss.kotlinlang.org/t/multiple-types-like-in-typescript/16728)._
