title: Typescript : Create custom type axios instance
body: <p>I want to create a complex type name api with an axios instance so that I can use the basic instance like this:</p>
  <pre><code>api.get(&quot;url&quot;)...
  </code></pre>
  <p>But also to be able to have new dynamic bodies such as:</p>
  <pre><code>api.myApi.get(&quot;url&quot;)
  </code></pre>
  <p>And finally, be able to read the list of instances like this:</p>
  <pre><code>api.list
  </code></pre>
  <p>Must be return</p>
  <blockquote>
  <p>myApi</p>
  </blockquote>
  <p>When I want to extend AxiosInstance or inject properties to the main instance, I always get a type error.
  Any idea?</p>
  <p>My test :</p>
  <pre><code>type apiInstances = Record&lt;string, AxiosInstance&gt;
  type apiList = Record&lt;'list', string[]&gt;
  
  let api: apiInstances | apiList
  
  
  const instance = (baseURL: string) =&gt;
    axios.create({
      baseURL
    })
  
  const instances = { instance('myApi') }
  
  api = { ...instances, ...instance(''), list }
  </code></pre>
  <p>Error when I write <code>api.myApi.get(&quot;...&quot;)</code></p>
  <blockquote>
  <p>Property 'myApi' does not exist on type 'apiInstances | apiList'</p>
  </blockquote>