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

fix: AxiosHeaders toJSON() return types (#10956)

* fix(types): fix AxiosHeaders `toJSON` types;

* Apply suggestion from @cubic-dev-ai[bot]

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

* fix(types): add a boolean catch-all overload;

---------

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
Dmitriy Mozgovoy
2026-05-28 19:55:27 +03:00
committed by GitHub
parent fcca2dd855
commit 2d2314a1ac
3 changed files with 8 additions and 3 deletions
+2 -1
View File
@@ -2161,7 +2161,8 @@ Returns a new `AxiosHeaders` instance.
### AxiosHeaders#toJSON(asStrings?)
```
toJSON(asStrings?: boolean): RawAxiosHeaders;
toJSON(asStrings: true): Record<string, string>;
toJSON(asStrings?: false): Record<string, string | string[]>;
```
Resolve all internal header values into a new null prototype object.
+3 -1
View File
@@ -66,7 +66,9 @@ declare class AxiosHeaders {
...targets: Array<AxiosHeaders | axios.RawAxiosHeaders | string | undefined | null>
): AxiosHeaders;
toJSON(asStrings?: boolean): axios.RawAxiosHeaders;
toJSON(asStrings: true): Record<string, string>;
toJSON(asStrings?: false): Record<string, string | string[]>;
toJSON(asStrings?: boolean): Record<string, string | string[]>;
static from(thing?: AxiosHeaders | axios.RawAxiosHeaders | string): AxiosHeaders;
Vendored
+3 -1
View File
@@ -47,7 +47,9 @@ export class AxiosHeaders {
...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>
): AxiosHeaders;
toJSON(asStrings?: boolean): RawAxiosHeaders;
toJSON(asStrings: true): Record<string, string>;
toJSON(asStrings?: false): Record<string, string | string[]>;
toJSON(asStrings?: boolean): Record<string, string | string[]>;
static from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders;