title: How to export Axios.create in Typescript
body: <p>I have this working:</p>
  <pre><code>export default axios.create({
    baseURL: 'sample',
    headers: {
      'Content-Type': 'application/json',
    },
    transformRequest: [
      (data) =&gt; {
        return JSON.stringify(data);
      },
    ],
  });
  </code></pre>
  <p>but the problem is once I edited to be like this:</p>
  <pre><code>const API = () =&gt; {
   const token = 'sample'
  
    const api: AxiosInstance = axios.create({
      baseURL: 'http://localhost:5000',
      headers: {
        'Content-Type': 'application/json',
        Authorization: `Bearer ${token}`,
      },
      transformRequest: [
        (data) =&gt; {
          return JSON.stringify(data);
        },
      ],
      transformResponse: [
        (data) =&gt; {
          return JSON.parse(data);
        },
      ],
    });
  
    return api;
  };
  
  export default API;
  </code></pre>
  <p>I want it to be an arrow function so I can access the token inside the function.</p>
  <p>The problem is once I start to import the arrow function it will create an error not reading POST method</p>
  <pre><code>import API from 'apis';
  
  API.post 
  </code></pre>
  <p>Is there a way to implement it like an arrow function but will not lose the type definitions or create an error?</p>