2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-15 11:59:42 +03:00
Commit Graph

28 Commits

Author SHA1 Message Date
Rodry 2c9cc76ee9 revert: change type of AxiosResponse to any (#4186)
* revert: change type of AxiosResponse to any

* types: add back default types

My bad xD

* Remove redundant default params
2021-10-22 10:14:23 +02:00
Remco Haszing 94a9344799 Test types (#4140)
* Distinguish request and response data types

* Fix Axios headers type

`axios.headers` is not of the same type as `request.headers`, so a new type
`AxiosDefaults` was introduced

* Replace grunt-ts with dtslint

This asserts that the type definitions are valid in the specified TypeScript
version and above. This is the same tool that is used by DefinitelyTyped.

* Remove grunt-ts

* Restore typescript dependency

* Fix missing semicolons

Co-authored-by: Claas Augner <github@caugner.de>
Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-10-12 09:53:10 +02:00
Remco Haszing 92b29d2775 Make the default type of response data never (#3002)
This requires TypeScript users to explicitly define the type of the data they
are consuming.

Before this, data was `any` by default. This means TypeScript consumers didn’t
get type safety if they forgot to specify the type.

Technically this is a breaking change for TypeScript users, as this will report
errors if they forgot to specifiy the response type. The simplest workaround
would be to explicitly set the response type to `any`, so it’s not breaking
much.

The `unknown` type is probably a slightly better fit, but this requires
TypeScript ^3.

`data` is still `any` in the very specific use case mentioned in
https://github.com/microsoft/TypeScript/issues/38969

Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-09-05 14:11:25 +02:00
Carlos Chida 4eeb3b17e2 Improved type-safety for AxiosRequestConfig (#2995)
* Improved type-safety for AxiosRequestConfig

- AxiosRequestConfig is now a generic type whose template corresponds to data

Signed-off-by: Carlos Chida <carlos.chida@starchitecture.eu>

* Fixed tests

- TS tests now match the behaviour described in the PR

Signed-off-by: Carlos Chida <carlos.chida@starchitecture.eu>

Co-authored-by: Jay <jasonsaayman@gmail.com>
2021-09-05 14:06:05 +02:00
Jason Kwok f472e5da5f Adding a type guard for AxiosError (#2949)
Co-authored-by: Jason Kwok <JasonHK@users.noreply.github.com>
2020-11-03 10:01:07 +02:00
Taemin Shin 3a8b87d48a Fixing an issue that type 'null' and 'undefined' is not assignable to validateStatus when typescript strict option is enabled (#3200) 2020-10-20 08:04:44 +02:00
Benny Neugebauer c120f44d3d Fixing 'progressEvent' type (#2851)
* Fix 'progressEvent' type

* Update axios.ts
2020-03-28 17:51:42 +08:00
grumblerchester c98ce7d464 Adding tests for method options type definitions (#1996)
Update tests.

Co-authored-by: Xianming Zhong <chinesedfan@qq.com>
2020-03-07 14:10:34 +08:00
Gustavo López 6642ca9aa1 Add independent maxBodyLength option (#2781)
* Add independent option to set the maximum size of the request body

* Remove maxBodyLength check

* Update README

* Assert for error code and message
2020-03-06 21:55:19 +08:00
Stephan Schneider 73cab975f0 typings: allow custom return types
response interceptor might change the type from AxiosResponse to anything they like
2018-06-18 10:48:29 +02:00
Andrew Scott f9373e96f2 Added tests for additional type parameters 2018-03-07 22:17:44 -08:00
Evan Shortiss d07e648c30 Fixing type definitions so AxiosInstance can be invoked 2017-12-20 21:45:48 -08:00
Daniel Fischer b0dccc6f16 Updated TypeScript typings with generic type parameters for request methods & AxiosResponse 2017-08-29 20:53:49 +02:00
Nick Uraltsev 3704d57ed4 Removing Promise from axios typings in favor of built-in type declarations 2017-03-14 19:23:05 -07:00
Nick Uraltsev 3ddeae60e5 Getting rid of TypeScript output files 2016-10-24 18:24:36 -07:00
Nick Uraltsev 216e2a6787 Adding axios.isCancel method 2016-09-21 18:47:37 -07:00
Nick Uraltsev 2033ef3ad0 Adding TypeScript definitions for cancel tokens 2016-09-17 12:49:14 -07:00
Nick Uraltsev 20666942d6 Adding proxy to TypeScript definitions 2016-08-24 15:48:14 -07:00
Nick Uraltsev 96d7ac2a0c Replacing progress with onUploadProgress and onDownloadProgress in TypeScript definitions 2016-08-23 18:29:25 -07:00
Nick Uraltsev 2325216239 Updating TypeScript definition tests 2016-08-18 20:01:54 -07:00
Nick Uraltsev 48549c8de7 Updating TypeScript definitions for axios.all and axios.spread 2016-08-16 19:03:28 -07:00
Nick Uraltsev 9a5e77bf6e Adding TypeScript definitions for adapters 2016-08-16 10:49:32 -07:00
Nick Uraltsev 0664d9895a Adding TypeScript definitions for interceptors 2016-08-16 09:34:23 -07:00
Nick Uraltsev 5176dfdec5 Converting TypeScript definitions to ES2015 module syntax 2016-08-09 23:17:11 -07:00
Nick Uraltsev 4ac0fbd1c1 Rename axios.createNew to axios.create 2015-10-23 08:40:46 -07:00
Nick Uraltsev b10874fa67 Make axios instantiable 2015-10-03 09:38:16 -07:00
mzabriskie 2ce5aa77df Releasing 0.5.2 2015-03-13 17:13:41 -06:00
Bret Little 7753adde2c Add a TypeScript definition for Axios with included tests 2014-11-18 15:53:04 -07:00