title: typescript interface is giving typeerror
body: <p>why does typescript throws error on</p>
  <pre><code>interface IEmailUpdateCode {
    userId: string;
    smsCode: string;
    newEmail: string;
  }
  
  const val1: IEmailUpdateCode = {
      userId:&quot;293842&quot;,
      smsCode:&quot;293480243&quot;,
      newEmail:&quot;abc@gm.com&quot;
  }
  
  const data1:{
      [key: string]: string | number;
  } = val1;
  
  //error: Type 'IEmailUpdateCode' is not assignable to type '{ [key: string]: string | number; }'
  </code></pre>
  <p>but no error when written like this</p>
  <pre><code>const val2:{
       userId: string;
    smsCode: string;
    newEmail: string;
  } = {
      userId:&quot;293842&quot;,
      smsCode:&quot;293480243&quot;,
      newEmail:&quot;abc@gm.com&quot;
  }
  
  const data2:{
      [key: string]: string | number;
  } = val2;
  </code></pre>
  <p>how can i make it work by using TS interfaces?</p>
  <p><a href="https://www.typescriptlang.org/play?#code/JYOwLgpgTgZghgYwgAgJIFEC2dgBsCqADgCZyQDCA9sSgN4CwAUMsgK4DO0qxAXMu2CigA5gG4mLdpnZUafAUJBiJyEBADuWHLnmCR4xgF8mTBJRADkANzi4AjHwzY8RUhWooAvMgbMWbTihuHgAiACYATgBmAA4AFjCQgBoVSWlZCFDIqLiYgAYwuKjk1NUNLTxQuAAjBAABYUwAOjNMEKZjRlNzSzc4B19-ZABtAGsIAE9dRWEAXWmRZAAfVVZMaugDQ2RvG3sDEy7GMwswa1swnkGhji5efj0lAzSZDwWnlTVNZx0Hma2dj5SrcgrxwtF4okUn4XhkstFcgUiiUYWVvtoqrUGs1Wu0jIcTr0yHBLtcWGNJu85lTlqt1psOoC9mEDowgA" rel="nofollow noreferrer">here</a> is the TS playground link</p>