title: Typescript: async function not working as expected
body: <p>I have the following asynchronous function</p>
  <pre class="lang-js prettyprint-override"><code>export const getCodCat = async (birthPlace: string): Promise&lt;string&gt; =&gt; {
      const url: string = `https://example.com/${birthPlace}`;
  
      const res = await axios(url);
      const html = await res.data;
      const $: cheerio.Root = cheerio.load(html);
  
  
      const rows: cheerio.Cheerio = $(&quot;table &gt; tbody &gt; tr&quot;);
  
      rows.each((_, element: cheerio.Element) =&gt; {
          const tds: cheerio.Cheerio = $(element).find(&quot;td&quot;);
          const code: string = $(tds[0]).text();
          const city: string = $(tds[1]).text();
  
          if(city === birthPlace)
              return code;
      });
  
      return &quot;&quot;;
  }
  </code></pre>
  <p>which is being called by the following function where the promise is immediately consumed:</p>
  <pre class="lang-js prettyprint-override"><code>const cityCode = (identity: Identity): Identity =&gt; {
      getCodCat(identity.birthPlace).then(codC =&gt; {
          identity.codC = codC;
          return identity;
  
      });
  
      return identity;
  }
  </code></pre>
  <p>The problem is, whenever I call <code>cityCode</code>, I get an empty <code>identity</code> object.
  The promise is being properly consumed so I don't know what I'm doing wrong.</p>