title: Javascript Optional chaining doesnt work with template literals
body: <p>I am trying to apply template literal with optional chaining.</p>
  <pre><code>type Item = {
  itemId:number,
  price: number};
  
  type ItemType = {
  A:Item,
  B:Item
  };
  
  const data : ItemType = {
    A:{itemId:1, price:2},
    B:{itemId:2, price:3}
  };
  
  let Itemid = `data?.${variable}?.itemId`
  
  
  </code></pre>
  <p>where variable is a string with A or B as value.
  I am not sure if optional chaining and template literals are supported together. Any Leads is appreciated.</p>
  <p>Edited:
  I am receiving &quot;string cant be used to index type Item' when tried with <code>data?.[variable]?.itemId</code>. I have updated with type now.</p>
  <p>Edited:
  Removing type of variable helped in solving above error message.</p>