title: Defining a union type based on object's property in array functionally
body: <p>I have a bunch of arrays with enums and their human readable counterparts.</p>
  
  <p>I was hoping to be able to build a enum union type for each possible variation dynamically as some of the arrays are rather long.</p>
  
  <pre><code>interface EnumType { enumValue: string, value: string }
  export type enumArrayType = Array&lt;EnumType&gt; 
  
  export const cpuSocket: enumArrayType = [
    { enumValue: 'LGA1150', value: 'LGA 1150' },
    { enumValue: 'LGA1151', value: 'LGA 1151' }
  ]
  
  export const cpuBrand: enumArrayType = [
    { enumValue: 'INTEL', value: 'Intel' },
    { enumValue: 'AMD', value: 'Amd' }
  ]
  
  type CpuBrandEnumTypes = 'INTEL' | 'AMD'
  
  type cpuType = {
    brand: CpuBrandEnumTypes
  }
  const cpu: cpuType = {}
  cpu.brand: CpuBrandEnumTypes = INTEL // WORKS!
  cpu.brand: CpuBrandEnumTypes = intel // ERROR!
  cpu.brand: CpuBrandEnumTypes = amd // ERROR!
  cpu.brand: CpuBrandEnumTypes = AMD // WORKS!
  </code></pre>