title: How to declare typescript type within a js array map?
body: <p>I am trying to make the following mapping with the js array map function <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map</a></p>
  <pre><code>x =  state.users.map(({id, firstName, lastName}) =&gt; 
      ({id, value: `${firstName} ${lastName}`}));
  </code></pre>
  <p>However, I am getting the following typescript error <code>Binding element 'X' implicitly has an any type</code> for each of the properties e.g. id, firstname etc</p>
  <p>If I try to assign a type to the properties like so:</p>
  <pre><code>x =  state.users.map(({id: number, firstName: string, lastName: string}) =&gt; 
      ({id, value: `${firstName} ${lastName}`}));
  </code></pre>
  <p>these are allocated as values not types.</p>
  <p>How can I correctly assign a type to a property within a map function?</p>