title: How do I use an array of strings to be an interface's keys?
body: <p>Suppose I have this array of strings:</p>
  <pre><code>const claims = ['val1','val2','val3','val4', ...]
  </code></pre>
  <h2>How can I build an interface based on the values in <code>claims</code> like this:</h2>
  <pre><code>interface Claims {
    val1: boolean
    val2: boolean
    val3: boolean
    val4: boolean
    ...
  }
  </code></pre>
  <p>I'm using Typescript 3.7.x</p>
  <hr />
  <p>I tried playing off of this answer: <a href="https://stackoverflow.com/a/46344193/1439748">https://stackoverflow.com/a/46344193/1439748</a></p>
  <blockquote>
  <pre><code>interface Claims{
   [key in claims[number]]?: boolean
  }
  </code></pre>
  </blockquote>
  <p>But received these errors:</p>
  <pre><code>A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.ts(1169)
  A computed property name must be of type 'string', 'number', 'symbol', or 'any'.ts(2464)
  The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.ts(2361)
  'number' only refers to a type, but is being used as a value here.ts(2693)
  </code></pre>