title: How do I return only type of resolve in a Promise?
body: <pre><code>let companyInfo: PublicCompanyAPIResponseType;
  companyInfo = await get&lt;PublicCompanyAPIResponseType&gt;({
      url: getCompanyDataURL,
  }).catch(res =&gt; {
      responseStatus = res.status;
  });
  </code></pre>
  
  <p>When i assign companyInfo variable to that get func</p>
  
  <pre><code>export async function get&lt;T&gt;({ url, headers }: ApiConnectSet): Promise&lt;T&gt; {
  return new Promise((resolve, reject) =&gt; {
      fetch(url, {
          method: 'GET',
          credentials: 'same-origin',
          headers: headers,
      })
          .then(async res =&gt; {
              if (res.ok) {
                  return resolve((await res.json()) as Promise&lt;T&gt;);
              } else if (res.status === 401) {
                  const redirectPath = window.location.pathname;
                  window.location.href =
                      '/login?redirectPath=' + redirectPath;
              } else {
                  reject(res);
              }
          })
          .catch(error =&gt; {
              reject(error);
          });
  });
  </code></pre>
  
  <p>}</p>
  
  <p>Visual studio code shows this error
  <a href="https://i.stack.imgur.com/8eqoV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8eqoV.png" alt="enter image description here"></a></p>
  
  <p>How can my get function only return <code>PublicCompanyAPIResponseType</code>?</p>