title: react and typescript - no index signature with a parameter of type 'string' was found on type x
body: <p>I have an react aplication with typescript, I'm trying to access a property from my component state by key value, but I'm getting the erro below:</p>
  <pre><code>Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Product'.
  No index signature with a parameter of type 'string' was found on type 'Product'.
  </code></pre>
  <p>I have a separated types files:</p>
  <pre><code>&gt;&gt;&gt; types.ts
  
  export type Product = {
     name: string,
     active: boolean,
     ...
  }
  
  </code></pre>
  <p>And the code of my component I'm trying to access like:</p>
  <pre><code>MyComponent.tsx
  
  const [products, setProducts] = useState&lt;Product | null&gt;();
  
  ...
  
  const myProduct = 'name';
  
  products[myProduct] // this line will give my editor the warning
  
  products['name'] // this line is fine
  
  </code></pre>
  <p>Both lines works just fine without any errors on my aplication, but vscode keeps complaning.</p>