title: Cannot access data property of Axios response object after successful GET request: Property 'data' does not exist on type 'void'
body: <p>I'm building a personal project with React and TypeScript to learn the ropes, and I'm stuck with a strange (to me) error on the following block, where I use Axios to fetch some data:</p>
  
  <pre><code>const fetchItem = async () =&gt; {
    const response = await axios
      .get("http://localhost:4000/items?id=2")
      .catch(error =&gt; console.log(error));
    console.log(response.data);
  };
  </code></pre>
  
  <p>The error message is <code>Property 'data' does not exist on type 'void'</code> and pops up immediately on Visual Studio Code as soon as I try to access the <code>data</code> property of my <code>response</code> object.</p>
  
  <p>How can I access <code>response.data</code> correctly (without having both my IDE and Webpack complaining)?</p>
  
  <p>Here is the full code of my component, for reference:</p>
  
  <pre><code>import * as React from "react";
  import { css } from "emotion";
  import axios from "axios";
  
  import { Item } from "./Item/Item";
  
  export interface ContentProps {
    view: string;
  }
  
  const fetchItem = async () =&gt; {
    const response = await axios
      .get("http://localhost:4000/items?id=2")
      .catch(error =&gt; console.log(error));
    console.log(response.data);
  };
  
  export class Content extends React.Component&lt;ContentProps&gt; {
    state = {
      text: "test"
    };
  
    componentDidMount() {
      fetchItem();
    }
  
    render() {
      return (
        &lt;div&gt;
          {this.props.view === "item" ? (
            &lt;Item text={this.state.text} /&gt;
          ) : (
            &lt;List /&gt;
          )}
        &lt;/div&gt;
      );
    }
  }
  </code></pre>
  
  <p>The error on webpack:</p>
  
  <p><a href="https://i.stack.imgur.com/ULek0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ULek0.png" alt="enter image description here"></a></p>
  
  <p>The full error text on VSC's tooltip states: <code>Property 'data' does not exist on type 'void | AxiosResponse&lt;any&gt;'.</code>.</p>