Skip to content

Commit

Permalink
refactor(style-guide): enforce style guide on index.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
gprst committed Jun 25, 2022
1 parent 0c338d9 commit a0c67f4
Showing 1 changed file with 47 additions and 47 deletions.
94 changes: 47 additions & 47 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type MethodsHeaders = {
[Key in Method as Lowercase<Key>]: AxiosHeaders;
};

interface CommonHeaders {
interface CommonHeaders {
common: AxiosHeaders;
}

Expand All @@ -15,14 +15,14 @@ type AxiosHeaderMatcher = (this: AxiosHeaders, value: string, name: string, head
type AxiosHeaderSetter = (value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher) => AxiosHeaders;

type AxiosHeaderGetter = ((parser?: RegExp) => RegExpExecArray | null) |
((matcher?: AxiosHeaderMatcher) => AxiosHeaderValue);
((matcher?: AxiosHeaderMatcher) => AxiosHeaderValue);

type AxiosHeaderTester = (matcher?: AxiosHeaderMatcher) => boolean;

export class AxiosHeaders {
constructor(
headers?: RawAxiosHeaders | AxiosHeaders,
defaultHeaders?: RawAxiosHeaders | AxiosHeaders
headers?: RawAxiosHeaders | AxiosHeaders,
defaultHeaders?: RawAxiosHeaders | AxiosHeaders
);

set(headerName?: string, value?: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
Expand Down Expand Up @@ -104,38 +104,38 @@ export interface AxiosProxyConfig {
}

export type Method =
| 'get' | 'GET'
| 'delete' | 'DELETE'
| 'head' | 'HEAD'
| 'options' | 'OPTIONS'
| 'post' | 'POST'
| 'put' | 'PUT'
| 'patch' | 'PATCH'
| 'purge' | 'PURGE'
| 'link' | 'LINK'
| 'unlink' | 'UNLINK';
| 'get' | 'GET'
| 'delete' | 'DELETE'
| 'head' | 'HEAD'
| 'options' | 'OPTIONS'
| 'post' | 'POST'
| 'put' | 'PUT'
| 'patch' | 'PATCH'
| 'purge' | 'PURGE'
| 'link' | 'LINK'
| 'unlink' | 'UNLINK';

export type ResponseType =
| 'arraybuffer'
| 'blob'
| 'document'
| 'json'
| 'text'
| 'stream';
| 'arraybuffer'
| 'blob'
| 'document'
| 'json'
| 'text'
| 'stream';

export type responseEncoding =
| 'ascii' | 'ASCII'
| 'ansi' | 'ANSI'
| 'binary' | 'BINARY'
| 'base64' | 'BASE64'
| 'base64url' | 'BASE64URL'
| 'hex' | 'HEX'
| 'latin1' | 'LATIN1'
| 'ucs-2' | 'UCS-2'
| 'ucs2' | 'UCS2'
| 'utf-8' | 'UTF-8'
| 'utf8' | 'UTF8'
| 'utf16le' | 'UTF16LE';
| 'ascii' | 'ASCII'
| 'ansi' | 'ANSI'
| 'binary' | 'BINARY'
| 'base64' | 'BASE64'
| 'base64url' | 'BASE64URL'
| 'hex' | 'HEX'
| 'latin1' | 'LATIN1'
| 'ucs-2' | 'UCS-2'
| 'ucs2' | 'UCS2'
| 'utf-8' | 'UTF-8'
| 'utf8' | 'UTF8'
| 'utf16le' | 'UTF16LE';

export interface TransitionalOptions {
silentJSONParsing?: boolean;
Expand All @@ -158,11 +158,11 @@ export interface FormDataVisitorHelpers {

export interface SerializerVisitor {
(
this: GenericFormData,
value: any,
key: string | number,
path: null | Array<string | number>,
helpers: FormDataVisitorHelpers
this: GenericFormData,
value: any,
key: string | number,
path: null | Array<string | number>,
helpers: FormDataVisitorHelpers
): boolean;
}

Expand Down Expand Up @@ -226,7 +226,7 @@ export interface AxiosRequestConfig<D = any> {
maxBodyLength?: number;
maxRedirects?: number;
maxRate?: number | [MaxUploadRate, MaxDownloadRate];
beforeRedirect?: (options: Record<string, any>, responseDetails: {headers: Record<string, string>}) => void;
beforeRedirect?: (options: Record<string, any>, responseDetails: { headers: Record<string, string> }) => void;
socketPath?: string | null;
httpAgent?: any;
httpsAgent?: any;
Expand Down Expand Up @@ -264,7 +264,7 @@ export interface CreateAxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>
headers?: RawAxiosRequestHeaders | Partial<HeadersDefaults>;
}

export interface AxiosResponse<T = any, D = any> {
export interface AxiosResponse<T = any, D = any> {
data: T;
status: number;
statusText: string;
Expand All @@ -275,11 +275,11 @@ export interface AxiosResponse<T = any, D = any> {

export class AxiosError<T = unknown, D = any> extends Error {
constructor(
message?: string,
code?: string,
config?: AxiosRequestConfig<D>,
request?: any,
response?: AxiosResponse<T, D>
message?: string,
code?: string,
config?: AxiosRequestConfig<D>,
request?: any,
response?: AxiosResponse<T, D>
);

config?: AxiosRequestConfig<D>;
Expand Down Expand Up @@ -310,7 +310,7 @@ export class CanceledError<T> extends AxiosError<T> {
export type AxiosPromise<T = any> = Promise<AxiosResponse<T>>;

export interface CancelStatic {
new (message?: string): Cancel;
new(message?: string): Cancel;
}

export interface Cancel {
Expand All @@ -322,7 +322,7 @@ export interface Canceler {
}

export interface CancelTokenStatic {
new (executor: (cancel: Canceler) => void): CancelToken;
new(executor: (cancel: Canceler) => void): CancelToken;
source(): CancelTokenSource;
}

Expand Down Expand Up @@ -401,7 +401,7 @@ export interface AxiosStatic extends AxiosInstance {
spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
isAxiosError<T = any, D = any>(payload: any): payload is AxiosError<T, D>;
toFormData(sourceObj: object, targetFormData?: GenericFormData, options?: FormSerializerOptions): GenericFormData;
formToJSON(form: GenericFormData|GenericHTMLFormElement): object;
formToJSON(form: GenericFormData | GenericHTMLFormElement): object;
}

declare const axios: AxiosStatic;
Expand Down

0 comments on commit a0c67f4

Please sign in to comment.