mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
Define string key for AxiosXHRConfigBase.headers (#11976)
When setting headers, tsc complains that "Index signature of object type implicitly has an 'any' type." E.g. ajaxSettings.headers["Authorization"] = "secret";
This commit is contained in:
committed by
Masahiro Wakame
parent
34e2854b9e
commit
e6215d4444
@@ -69,6 +69,10 @@ axios.post("http://example.com/", {
|
||||
]
|
||||
});
|
||||
|
||||
var config: Axios.AxiosXHRConfigBase<any> = {headers: {}};
|
||||
config.headers['X-Custom-Header'] = 'baz';
|
||||
axios.post("http://example.com/", config);
|
||||
|
||||
var getRepoIssue = axios.get<Issue>("https://api.github.com/repos/mzabriskie/axios/issues/1");
|
||||
|
||||
var axiosInstance = axios.create({
|
||||
|
||||
2
axios/axios.d.ts
vendored
2
axios/axios.d.ts
vendored
@@ -39,7 +39,7 @@ declare namespace Axios {
|
||||
/**
|
||||
* custom headers to be sent
|
||||
*/
|
||||
headers?: Object;
|
||||
headers?: {[key: string]: any};
|
||||
|
||||
/**
|
||||
* URL parameters to be sent with the request
|
||||
|
||||
Reference in New Issue
Block a user