title: How to define string literal union type from constants in Typescript
body: <p>I know I can define string union types to restrict variables to one of the possible string values:</p>
  
  <pre><code>type MyType = 'first' | 'second'
  let myVar:MyType = 'first'
  </code></pre>
  
  <p>I need to construct a type like that from constant strings, e.g:</p>
  
  <pre><code>const MY_CONSTANT = 'MY_CONSTANT'
  const SOMETHING_ELSE = 'SOMETHING_ELSE'
  type MyType = MY_CONSTANT | SOMETHING_ELSE
  </code></pre>
  
  <p>But for some reason it doesn't work; it says <code>MY_CONSTANT refers to a value, but it being used as a type here</code>.</p>
  
  <p>Why does Typescript allow the first example, but doesn't allow the second case? I'm on Typescript 3.4.5</p>