Typescript - properties and index accessor at the same time
<p><strong>Is there a way to use strongly typed index accessor and access properties at the same time, without repeating the properties in type annotation?</strong></p>

<pre><code>let profile = profiles[profileKey];
let profile = profiles.ADMIN;
</code></pre>

<hr />

<p>I have dictionary of key value pair defined like this:</p>

<pre><code>const profiles = {
    "ADMIN": "Admin",
    "TCA": "Test Center Admin",
    "TT": "Test Taker",
};
</code></pre>

<p>now properties of profiles const are infered and I can write <code>let admin = profiles.ADMIN</code>.</p>

<p>BUT in order to use index acessor I have to explicitely specify it:</p>

<pre><code>const profiles: {[profileKey: string]: string} = {
    "ADMIN": "Admin",
    "TCA": "Test Center Admin",
    "TT": "Test Taker",
};
</code></pre>

<p>However, now I can't access properties.</p>

<p>I know I can define all the properties in the profiles` type annotation:</p>

<pre><code>interface IProfiles {
   [profileKey: string]: string;
   ADMIN: string,
   TCA: string,
   TT: string,
}
</code></pre>

<p>but this is just repeating myself. Properties could be inferred, just like when I don't specify any annotation. Is this possible?</p>