How do I extract a type from an array in typescript? : <p>Is there a way to declare a type in typescript that 'extracts' the inner type of an array?</p>

<p>Example: </p>

<p>Let's say I already have something like this in my codebase:</p>

<pre class="lang-typescript prettyprint-override"><code>export interface Cache {
    events: Event[],
    users: User[]
}
type CacheType = Event[] | User[];

//or maybe: 
//   type TypeOfProperty = T[keyof T];
//   type CacheType = TypeOfProperty&lt;Cache&gt;; 
</code></pre>

<p>What I want is something which would be equivalent to this: </p>

<pre class="lang-typescript prettyprint-override"><code>type InnerCacheType = Event | User;
</code></pre>

<p>But without manually retyping it every time I add something to <code>Cache</code> or <code>CacheType</code></p>

<p>Is this possible in Typescript?</p>
