From 5078f174a6d5ae990459592f2b7de6b025be0521 Mon Sep 17 00:00:00 2001 From: marcosnocetti Date: Thu, 9 Apr 2026 22:41:24 -0300 Subject: [PATCH] fix(types): constrain AxiosHeaders index signature from any to AxiosHeaderValue Changes `[key: string]: any` to `[key: string]: AxiosHeaderValue | ((...args: any[]) => any)` in the AxiosHeaders class definition. This prevents assigning invalid types like Promise or plain objects to headers while maintaining compatibility with class methods. Closes #7487 --- index.d.cts | 2 +- index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.d.cts b/index.d.cts index f36ef066..b6a5f7c0 100644 --- a/index.d.cts +++ b/index.d.cts @@ -46,7 +46,7 @@ type BrowserProgressEvent = any; declare class AxiosHeaders { constructor(headers?: RawAxiosHeaders | AxiosHeaders | string); - [key: string]: any; + [key: string]: axios.AxiosHeaderValue | ((...args: any[]) => any); set( headerName?: string, diff --git a/index.d.ts b/index.d.ts index d3f646ea..8311a5a5 100644 --- a/index.d.ts +++ b/index.d.ts @@ -23,7 +23,7 @@ type AxiosHeaderParser = (this: AxiosHeaders, value: AxiosHeaderValue, header: s export class AxiosHeaders { constructor(headers?: RawAxiosHeaders | AxiosHeaders | string); - [key: string]: any; + [key: string]: AxiosHeaderValue | ((...args: any[]) => any); set( headerName?: string,