title: Create constant array type from an object type
body: <p>I have an object type similar to this:</p>
  <pre class="lang-js prettyprint-override"><code>type Fields = {
    countryCode: string;
    currency: string;
    otherFields: string;
  };
  </code></pre>
  <p>I also have a readonly array similar to this:</p>
  <pre class="lang-js prettyprint-override"><code>// Type: readonly [&quot;countryCode&quot;, &quot;currency&quot;, &quot;otherFields&quot;]
  const allowedFields = [&quot;countryCode&quot;, &quot;currency&quot;, &quot;otherFields&quot;] as const;
  </code></pre>
  <p>I want to be able to specify an interface for this array declaration based on the <code>Fields</code> object type so that any change to it will require to change the array as well. Something like this:</p>
  <pre class="lang-js prettyprint-override"><code>// How to create 'SomeType'?
  const allowedFields: SomeType = [&quot;countryCode&quot;] as const; // Should throw error because there are missing fields
  
  const allowedFields: SomeType = [&quot;extraField&quot;] as const; // Should throw error because &quot;extraField&quot; is not in the object type 'Fields'
  </code></pre>