@@ -3,28 +3,28 @@ interface RawAxiosHeaders {
33}
44
55type MethodsHeaders = Partial < {
6- [ Key in axios . Method as Lowercase < Key > ] : AxiosHeaders ;
7- } & { common : AxiosHeaders } > ;
6+ [ Key in axios . Method as Lowercase < Key > ] : InternalAxiosHeaders ;
7+ } & { common : InternalAxiosHeaders } > ;
88
9- type AxiosHeaderMatcher = ( this : AxiosHeaders , value : string , name : string , headers : RawAxiosHeaders ) => boolean ;
9+ type AxiosHeaderMatcher = ( this : InternalAxiosHeaders , value : string , name : string , headers : RawAxiosHeaders ) => boolean ;
1010
11- type AxiosHeaderParser = ( this : AxiosHeaders , value : axios . AxiosHeaderValue , header : string ) => any ;
11+ type AxiosHeaderParser = ( this : InternalAxiosHeaders , value : axios . AxiosHeaderValue , header : string ) => any ;
1212
1313type CommonRequestHeadersList = 'Accept' | 'Content-Length' | 'User-Agent' | 'Content-Encoding' | 'Authorization' ;
1414
1515type ContentType = axios . AxiosHeaderValue | 'text/html' | 'text/plain' | 'multipart/form-data' | 'application/json' | 'application/x-www-form-urlencoded' | 'application/octet-stream' ;
1616
1717type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control' | 'Content-Encoding' ;
1818
19- declare class AxiosHeaders {
19+ declare class InternalAxiosHeaders {
2020 constructor (
21- headers ?: RawAxiosHeaders | AxiosHeaders | string
21+ headers ?: RawAxiosHeaders | InternalAxiosHeaders | string
2222 ) ;
2323
2424 [ key : string ] : any ;
2525
26- set ( headerName ?: string , value ?: axios . AxiosHeaderValue , rewrite ?: boolean | AxiosHeaderMatcher ) : AxiosHeaders ;
27- set ( headers ?: RawAxiosHeaders | AxiosHeaders | string , rewrite ?: boolean ) : AxiosHeaders ;
26+ set ( headerName ?: string , value ?: axios . AxiosHeaderValue , rewrite ?: boolean | AxiosHeaderMatcher ) : InternalAxiosHeaders ;
27+ set ( headers ?: RawAxiosHeaders | InternalAxiosHeaders | string , rewrite ?: boolean ) : InternalAxiosHeaders ;
2828
2929 get ( headerName : string , parser : RegExp ) : RegExpExecArray | null ;
3030 get ( headerName : string , matcher ?: true | AxiosHeaderParser ) : axios . AxiosHeaderValue ;
@@ -35,44 +35,44 @@ declare class AxiosHeaders {
3535
3636 clear ( matcher ?: AxiosHeaderMatcher ) : boolean ;
3737
38- normalize ( format : boolean ) : AxiosHeaders ;
38+ normalize ( format : boolean ) : InternalAxiosHeaders ;
3939
40- concat ( ...targets : Array < AxiosHeaders | RawAxiosHeaders | string | undefined | null > ) : AxiosHeaders ;
40+ concat ( ...targets : Array < InternalAxiosHeaders | RawAxiosHeaders | string | undefined | null > ) : InternalAxiosHeaders ;
4141
4242 toJSON ( asStrings ?: boolean ) : RawAxiosHeaders ;
4343
44- static from ( thing ?: AxiosHeaders | RawAxiosHeaders | string ) : AxiosHeaders ;
44+ static from ( thing ?: InternalAxiosHeaders | RawAxiosHeaders | string ) : InternalAxiosHeaders ;
4545
46- static accessor ( header : string | string [ ] ) : AxiosHeaders ;
46+ static accessor ( header : string | string [ ] ) : InternalAxiosHeaders ;
4747
48- static concat ( ...targets : Array < AxiosHeaders | RawAxiosHeaders | string | undefined | null > ) : AxiosHeaders ;
48+ static concat ( ...targets : Array < InternalAxiosHeaders | RawAxiosHeaders | string | undefined | null > ) : InternalAxiosHeaders ;
4949
50- setContentType ( value : ContentType , rewrite ?: boolean | AxiosHeaderMatcher ) : AxiosHeaders ;
50+ setContentType ( value : ContentType , rewrite ?: boolean | AxiosHeaderMatcher ) : InternalAxiosHeaders ;
5151 getContentType ( parser ?: RegExp ) : RegExpExecArray | null ;
5252 getContentType ( matcher ?: AxiosHeaderMatcher ) : axios . AxiosHeaderValue ;
5353 hasContentType ( matcher ?: AxiosHeaderMatcher ) : boolean ;
5454
55- setContentLength ( value : axios . AxiosHeaderValue , rewrite ?: boolean | AxiosHeaderMatcher ) : AxiosHeaders ;
55+ setContentLength ( value : axios . AxiosHeaderValue , rewrite ?: boolean | AxiosHeaderMatcher ) : InternalAxiosHeaders ;
5656 getContentLength ( parser ?: RegExp ) : RegExpExecArray | null ;
5757 getContentLength ( matcher ?: AxiosHeaderMatcher ) : axios . AxiosHeaderValue ;
5858 hasContentLength ( matcher ?: AxiosHeaderMatcher ) : boolean ;
5959
60- setAccept ( value : axios . AxiosHeaderValue , rewrite ?: boolean | AxiosHeaderMatcher ) : AxiosHeaders ;
60+ setAccept ( value : axios . AxiosHeaderValue , rewrite ?: boolean | AxiosHeaderMatcher ) : InternalAxiosHeaders ;
6161 getAccept ( parser ?: RegExp ) : RegExpExecArray | null ;
6262 getAccept ( matcher ?: AxiosHeaderMatcher ) : axios . AxiosHeaderValue ;
6363 hasAccept ( matcher ?: AxiosHeaderMatcher ) : boolean ;
6464
65- setUserAgent ( value : axios . AxiosHeaderValue , rewrite ?: boolean | AxiosHeaderMatcher ) : AxiosHeaders ;
65+ setUserAgent ( value : axios . AxiosHeaderValue , rewrite ?: boolean | AxiosHeaderMatcher ) : InternalAxiosHeaders ;
6666 getUserAgent ( parser ?: RegExp ) : RegExpExecArray | null ;
6767 getUserAgent ( matcher ?: AxiosHeaderMatcher ) : axios . AxiosHeaderValue ;
6868 hasUserAgent ( matcher ?: AxiosHeaderMatcher ) : boolean ;
6969
70- setContentEncoding ( value : axios . AxiosHeaderValue , rewrite ?: boolean | AxiosHeaderMatcher ) : AxiosHeaders ;
70+ setContentEncoding ( value : axios . AxiosHeaderValue , rewrite ?: boolean | AxiosHeaderMatcher ) : InternalAxiosHeaders ;
7171 getContentEncoding ( parser ?: RegExp ) : RegExpExecArray | null ;
7272 getContentEncoding ( matcher ?: AxiosHeaderMatcher ) : axios . AxiosHeaderValue ;
7373 hasContentEncoding ( matcher ?: AxiosHeaderMatcher ) : boolean ;
7474
75- setAuthorization ( value : axios . AxiosHeaderValue , rewrite ?: boolean | AxiosHeaderMatcher ) : AxiosHeaders ;
75+ setAuthorization ( value : axios . AxiosHeaderValue , rewrite ?: boolean | AxiosHeaderMatcher ) : InternalAxiosHeaders ;
7676 getAuthorization ( parser ?: RegExp ) : RegExpExecArray | null ;
7777 getAuthorization ( matcher ?: AxiosHeaderMatcher ) : axios . AxiosHeaderValue ;
7878 hasAuthorization ( matcher ?: AxiosHeaderMatcher ) : boolean ;
@@ -111,10 +111,10 @@ declare class AxiosError<T = unknown, D = any> extends Error {
111111 static readonly ETIMEDOUT = "ETIMEDOUT" ;
112112}
113113
114- declare class CanceledError < T > extends AxiosError < T > {
114+ declare class InternalCanceledError < T > extends AxiosError < T > {
115115}
116116
117- declare class Axios {
117+ declare class InternalAxios {
118118 constructor ( config ?: axios . AxiosRequestConfig ) ;
119119 defaults : axios . AxiosDefaults ;
120120 interceptors : {
@@ -135,7 +135,7 @@ declare class Axios {
135135 patchForm < T = any , R = axios . AxiosResponse < T > , D = any > ( url : string , data ?: D , config ?: axios . AxiosRequestConfig < D > ) : Promise < R > ;
136136}
137137
138- declare enum HttpStatusCode {
138+ declare enum InternalHttpStatusCode {
139139 Continue = 100 ,
140140 SwitchingProtocols = 101 ,
141141 Processing = 102 ,
@@ -205,6 +205,10 @@ type InternalAxiosError<T = unknown, D = any> = AxiosError<T, D>;
205205
206206declare namespace axios {
207207 type AxiosError < T = unknown , D = any > = InternalAxiosError < T , D > ;
208+ type Axios = InternalAxios ;
209+ type AxiosHeaders = InternalAxiosHeaders ;
210+ type CanceledError < T > = InternalCanceledError < T > ;
211+ type HttpStatusCode = InternalHttpStatusCode ;
208212
209213 type RawAxiosRequestHeaders = Partial < RawAxiosHeaders & {
210214 [ Key in CommonRequestHeadersList ] : AxiosHeaderValue ;
@@ -398,7 +402,7 @@ declare namespace axios {
398402 maxBodyLength ?: number ;
399403 maxRedirects ?: number ;
400404 maxRate ?: number | [ MaxUploadRate , MaxDownloadRate ] ;
401- beforeRedirect ?: ( options : Record < string , any > , responseDetails : { headers : Record < string , string > , statusCode : HttpStatusCode } ) => void ;
405+ beforeRedirect ?: ( options : Record < string , any > , responseDetails : { headers : Record < string , string > , statusCode : InternalHttpStatusCode } ) => void ;
402406 socketPath ?: string | null ;
403407 transport ?: any ;
404408 httpAgent ?: any ;
@@ -503,7 +507,7 @@ declare namespace axios {
503507 clear ( ) : void ;
504508 }
505509
506- interface AxiosInstance extends Axios {
510+ interface AxiosInstance extends InternalAxios {
507511 < T = any , R = AxiosResponse < T > , D = any > ( config : AxiosRequestConfig < D > ) : Promise < R > ;
508512 < T = any , R = AxiosResponse < T > , D = any > ( url : string , config ?: AxiosRequestConfig < D > ) : Promise < R > ;
509513
@@ -525,13 +529,14 @@ declare namespace axios {
525529 }
526530
527531 interface AxiosStatic extends AxiosInstance {
532+ default : AxiosStatic ;
528533 create ( config ?: CreateAxiosDefaults ) : AxiosInstance ;
529534 Cancel : CancelStatic ;
530535 CancelToken : CancelTokenStatic ;
531- Axios : typeof Axios ;
536+ Axios : typeof InternalAxios ;
532537 AxiosError : typeof AxiosError ;
533- CanceledError : typeof CanceledError ;
534- HttpStatusCode : typeof HttpStatusCode ;
538+ CanceledError : typeof InternalCanceledError ;
539+ HttpStatusCode : typeof InternalHttpStatusCode ;
535540 readonly VERSION : string ;
536541 isCancel ( value : any ) : value is Cancel ;
537542 all < T > ( values : Array < T | Promise < T > > ) : Promise < T [ ] > ;
@@ -540,7 +545,7 @@ declare namespace axios {
540545 toFormData ( sourceObj : object , targetFormData ?: GenericFormData , options ?: FormSerializerOptions ) : GenericFormData ;
541546 formToJSON ( form : GenericFormData | GenericHTMLFormElement ) : object ;
542547 getAdapter ( adapters : AxiosAdapterConfig | AxiosAdapterConfig [ ] | undefined ) : AxiosAdapter ;
543- AxiosHeaders : typeof AxiosHeaders ;
548+ AxiosHeaders : typeof InternalAxiosHeaders ;
544549 }
545550}
546551
0 commit comments