title: Typescript enum value as array parameter
body: <p>I will first of all state, that I am using TypeScript2.4, so I can use string ENUMs, ala</p>
  
  <pre><code>export enum PermissionScope {
  BRAND = "brand",
  IMAGE_MARKER = "image-marker",
  COMPANY = "company",
  PRODUCT = "product",
  FINANCIALS = "financials"
  }
  </code></pre>
  
  <p>I don't know how to do 2 things.</p>
  
  <ol>
  <li><p>How can I type guard an enum, say</p>
  
  <pre><code>class A {
      let a : PermissionScope;
  }
  </code></pre></li>
  </ol>
  
  <p>now when I try to instantiate this variable by</p>
  
  <pre><code>A.a = PermissionScope.BRAND
  </code></pre>
  
  <p>I get an error</p>
  
  <pre><code>Type 'string' is not assignable to type 'PermissionScope'.
  </code></pre>
  
  <p>This can kindof be fixed by </p>
  
  <pre><code>A.a = &lt;PermissionScope&gt; PermissionScope.BRAND
  </code></pre>
  
  <p>But I'm unsure if this is the right solution because as I understand, the underlying problem is that the variable is expected to be of a PermissionScope Enum Object type, not of a valid Enum value from PermissionScope.</p>
  
  <p>How can I set the variable type so that it can only be one of the types from the enum?</p>
  
  <p>The second question is.</p>
  
  <ol start="2">
  <li><p>What if I want to ask if a string is a valid Enum value, aka</p>
  
  <pre><code>var a = "brand"; //true
  var b = "candy crush" //false
  </code></pre></li>
  </ol>