title: How to convert union type to enum in typescript?
body: <p>I want to covert union type to enum or like enum in typescript</p>
  
  <p>It doesn't work out with my brain.</p>
  
  <p>Thank you for reading my question.</p>
  
  <pre class="lang-js prettyprint-override"><code>type status = 'start' | 'loading' | 'stop';
  
  class Loading {
      static staticStatus: status;
  }
  Loading.staticStatus.start; // i want to use.
  </code></pre>
  
  <p>or</p>
  
  <pre class="lang-js prettyprint-override"><code>type status = 'start' | 'loading' | 'stop';
  
  enum statusEnum = ?????;
  
  class Loading {
      static staticStatus = statusEnum;
  }
  Loading.staticStatus.start; // i want to use.
  </code></pre>
  
  <hr>
  
  <p>I'm sorry I didn't write my questions in detail.</p>
  
  <pre><code>const schema ={
   status: Joi.string()
          .required()
          .valid(
              'start',
              'loading',
              'stop',
          )
  }
  
  // type setStatusType =  'start' | 'loading' | 'stop' is like this
  type setStatusType = PickType&lt;Joi.extractType&lt;typeof schema&gt;, 'status'&gt;; 
  
  enum statusEnum = ?????;
  
  class Loading {
      static staticStatus = statusEnum;
  
      public setLoading() {
      this.status = Loading.staticStatus.loading // I want to use this.
      }
  }
  </code></pre>
  
  <p>so I want to covert union type to enum...</p>