title: How to use TS type as a value
body: <p>I have a TypeScript type which has a bunch of strings and it's defined like this:</p>
  
  <pre><code>type Regions = "" | "eu-west-1" | "eu-east-1" | "us-west-1" | "us-east-1" | "ap-southeast-1" | "ap-east-1"
  </code></pre>
  
  <p>I then later on in my code get the region from the URL via query-string parameters. Let's say that the retrieved region from URL is a variable named <code>region</code></p>
  
  <p>So i'm doing some validation in my code and I want make sure the <code>region</code> is of the type <code>Regions</code>. </p>
  
  <p>So in order to do the validation my code says:
  <code>if (region in Regions) { doStuff();}</code></p>
  
  <p>Which would work if Region was a variable with all those regions. </p>
  
  <p>However since Regions is a type, it's throwing an error saying:
  <code>'Regions' only refers to a type, but is being used as a value here</code></p>
  
  <p>Which I understand why, but how can I achieve what i want to do using or extending the <code>type Regions</code></p>
  
  <p>I really don't want to create another object or array of strings, I just want use my existing type to do this validation. </p>
  
  <p>I did create an enum like this: </p>
  
  <pre><code>enum RegionsList {
    'eu-west-1',
    'eu-east-1',
    'us-west-1',
    'us-east-1',
    'ap-southeast-1',
    'ap-east-1'
  }
  </code></pre>
  
  <p>and then did <code>region in RegionsList</code> but this is kinda duplicating my Regions type already, and there has to be a better solution that combines the 2. Any help/suggestions is appreciated. </p>