diff --git a/index.d.ts b/index.d.ts index a33eb71743..452d2cc273 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,5 +1,7 @@ // TypeScript Version: 4.1 -type AxiosHeaders = Record; +type HeaderValue = string | string[] | number | boolean; + +type AxiosHeaders = Record>; type MethodsHeaders = { [Key in Method as Lowercase]: AxiosHeaders; diff --git a/test/typescript/axios.ts b/test/typescript/axios.ts index c0c61599e1..3b9b4b7adb 100644 --- a/test/typescript/axios.ts +++ b/test/typescript/axios.ts @@ -204,6 +204,10 @@ axios.post, string>('/user', { name: 'foo' }, { headers .then(handleStringResponse) .catch(handleError); +axios.post('/user', { name: 'foo', id: 1 }, { headers: { get: { 'X-FOO': 'bar' }} }) + .then(handleUserResponse) + .catch(handleError); + axios.put, string>('/user', { name: 'foo' }) .then(handleStringResponse) .catch(handleError);