Registry / devops / types-axios

types-axios

JSON →
library0.0.8jsnpmunverified

A TypeScript rewrite of axios, providing a Promise-based HTTP client for browser and Node.js. Version 0.0.8 is the latest stable release, with weekly or monthly updates. It aims to bring full TypeScript support to axios, including type definitions for request/response, interceptors, and cancellation. Differentiates from the original axios by offering native TypeScript types out-of-the-box, though it may lag behind axios updates. Supports browser XMLHttpRequests and Node.js http, request/response interception, transformation, and automatic JSON parsing.

npm install types-axios
INSTALL
IMPORT
SIG · TYPES-AXIOS
T
types-axios
devopsjavascriptv0.0.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import axios from 'types-axios'
import * as axios from 'types-axios'
Default import is the recommended way for ESM. In CommonJS, use const axios = require('types-axios').default.
AxiosInstance
import { AxiosInstance } from 'types-axios'
import { AxiosInstance } from 'axios'
AxiosInstance type is exported from types-axios. Use named import for TypeScript.
AxiosRequestConfig
import { AxiosRequestConfig } from 'types-axios'
import { AxiosRequestConfig } from 'axios'
Type definitions are part of the package; no need to install @types/axios.

Shows how to import the default axios instance, make a GET request with async/await, and access response data.

import axios from 'types-axios'; async function getUser() { const response = await axios.get('https://jsonplaceholder.typicode.com/users/1', { headers: { 'Accept': 'application/json' } }); console.log(response.data.name); } getUser().catch(console.error);
Debug
Known issues
gotchaThe package 'types-axios' is not the official axios TypeScript wrapper; it is a community rewrite. It may not maintain compatibility with future axios updates. Use the official 'axios' package with '@types/axios' for better long-term support.
fix
Consider using 'npm install axios @types/axios' instead for official TypeScript support.
affects: >=0.0.1
gotchaIn CommonJS (Node.js with require), you must use `require('types-axios').default` to get the axios instance. Using `require('types-axios')` directly yields a different object that may lack methods.
fix
Use `const axios = require('types-axios').default;`
affects: >=0.0.1
deprecatedThe package uses `axios.all` and `axios.spread` which are deprecated in favor of native `Promise.all`.
fix
Replace `axios.all([promises])` with `Promise.all([promises])` and `axios.spread` with direct destructuring.
affects: >=0.0.1
breakingVersion 0.0.8 may have different type exports compared to older versions. Some type names may have changed from the original axios.
fix
Check the package's type definitions for the correct exported names.
affects: >=0.0.8
Errors
Common errors & fixes
Cannot find module 'types-axios' or its corresponding type declarations.
The package is not installed or TypeScript cannot locate its types.
fix
Run `npm install types-axios` and ensure tsconfig.json includes 'node_modules/@types' or has 'skipLibCheck' appropriately.
axios_1.default is not a function
Using CommonJS require('types-axios') without .default.
fix
Use `const axios = require('types-axios').default;`
TypeError: axios.all is not a function
Deprecated axios.all not available in some builds.
fix
Use `Promise.all([...])` instead.
Upgrade
Version history
0.0.8latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
types-axios — npm install types-axios · libregistry