title: Typescript derive union type from tuple/array values
body: <p>Say I have list
  <code>const list = ['a', 'b', 'c']</code></p>
  
  <p>Is it possible to derive from this value union type that is <code>'a' | 'b' | 'c'</code>?</p>
  
  <p>I want this because I want to define type which allows only values from static array, and also need to enumerate these values at runtime, so I use array.</p>
  
  <p>Example how it can be implemented with an indexed object:</p>
  
  <pre><code>const indexed = {a: null, b: null, c: null}
  const list = Object.keys(index)
  type NeededUnionType = keyof typeof indexed
  </code></pre>
  
  <p>I wonder if it is possible to do it without using an indexed map.</p>