title: Why Does Typescript not Recognize Enum Members as Valid Properties When Using [key in enum] Index Signature
body: <p>I'm working on a TypeScript project and I'm running into a strange issue when using enum members as indexed keys for an interface. Both my enum and interface are declared in global .d.ts files (no imports or exports).</p>
  <pre><code>// enums.d.ts
  ...
  enum ItemFlag {
    IsPushable = &quot;isPushable&quot;,
    IsTakable = &quot;isTakable&quot;,
    IsUnique = &quot;isUnique&quot;
  }
  ...
  
  // interfaces.d.ts
  ...
  interface IThingProps {
    id: string;
    name: string;
  }
  
  interface IItemProps extends IThingProps {
    [key in ItemFlag]?: boolean;
  }
  ...
  </code></pre>
  <p>However, when I try to create an object which implements the <code>IItemProps</code> interface:</p>
  <pre><code>const props: IItemProps = {
    id: &quot;item_small_cup&quot;,
    name: &quot;small cup&quot;,
    [ItemFlag.IsTakable]: true
  };
  </code></pre>
  <p>I get the following error:</p>
  <p>&quot;Type '{ id: string; name: string; isTakable: boolean; }' is not assignable to type 'IItemProps'.
  Object literal may only specify known properties, and '[ItemFlag.IsTakable]' does not exist in type 'IItemProps'.&quot;</p>
  <p>What's odd is I'm doing this with another enum and it's working fine. The only difference is I'm declaring the type of the object using it inline like:</p>
  <pre><code>const genders: {[key in Gender]: Pronouns; } = {
    [Gender.It]: {
      they: &quot;it&quot;,
      them: &quot;it&quot;,
      // You get the idea
    }
  }
  </code></pre>
  <p>I suppose this example also doesn't have the property as optional, but removing the optional '?' from the index signature for <code>ItemFlag</code> doesn't change the error at all.</p>
  <p>Any insight as to this weird, inconsistant behavior?</p>