2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-17 19:21:29 +03:00

fix: fix TypeScript type definitions for commonjs (#5196)

This is done by duplicating `index.d.ts` into `index.d.cts`, and
modifying it for CommonJS. The same was done for type tests.

Unfortunately I was unable to find a way to re-use types without
drastically changing the code base.

To test this, a minimum TypeScript version of 4.7 is needed, so it has
been updated. The old types still work with older TypeScript versions.

Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
Remco Haszing
2022-11-10 19:23:02 +01:00
committed by GitHub
parent 7f0fc69569
commit abf954185a
8 changed files with 959 additions and 19 deletions
+5 -1
View File
@@ -5,6 +5,10 @@
"main": "index.js",
"exports": {
".": {
"types": {
"require": "./index.d.cts",
"default": "./index.d.ts"
},
"browser": {
"require": "./dist/browser/axios.cjs",
"default": "./index.js"
@@ -96,7 +100,7 @@
"sinon": "^4.5.0",
"stream-throttle": "^0.1.3",
"terser-webpack-plugin": "^4.2.3",
"typescript": "^4.6.3",
"typescript": "^4.8.4",
"url-search-params": "^0.10.0"
},
"browser": {