title: Typescript: Object of type 'unknown'
body: <p>I have a <strong>generator</strong> function <code>foo()</code> in which I am calling an <strong>API</strong> using <code>fetch</code>.
  After I receive the <strong>response</strong> from the <strong>API</strong>, I am parsing it as <strong>JSON</strong>.</p>
  
  <p>Typescript is throwing an error: <code>Object of type 'unknown'</code> in this line -> <code>const msg = yield response.json();</code></p>
  
  <pre><code>function* foo(val: ValType): Generator {
      const response = yield fetch(endPoint, {
          method: 'POST',
          body: JSON.stringify(val),
      });
  
      if (response) {
          // typescript throws error
          // that type is unknown for
          // the response object
          const msg = yield response.json();
          return msg;
      }
  }
  
  </code></pre>