title: Typescript, Object is of type 'unknown'
body: <p>I have this code:</p>
  <pre><code>const dataId = await getData(id);
  
  const result = dataId.requestPayload.officePaymentId; // error here
  </code></pre>
  <p>I get <code>Object is of type 'unknown'</code></p>
  <p>The function <code>getData()</code> is this one:</p>
  <pre><code>import { Agent } from '../types';
  export default async function getData&lt;T&gt;(
    id: string
  ): Promise&lt;Agent&lt;T&gt;&gt; {
    const Item = [something];
  
    return Item as Agent&lt;T&gt;;
  }
  </code></pre>
  <p>the <code>Agent</code> interface is:</p>
  <pre><code>export interface Agent&lt;T&gt; {
    id: string;
    requestPayload: T;
  }
  </code></pre>
  <p>How can I pass the definiton of the generic when I call the function <code>getData</code>? Or why I'm getting the mentioned error. Any hint please</p>