mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
refactor(types): use TypeScript utils to transform duplicated literals (#7520)
* refactor(types): use TypeScript utils to transform Method literals * refactor(types): use TypeScript utils to transform responseEncoding literals * refactor: revert added export for responseEncoding --------- Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
+6
-46
@@ -345,55 +345,15 @@ declare namespace axios {
|
||||
protocol?: string;
|
||||
}
|
||||
|
||||
type Method =
|
||||
| 'get'
|
||||
| 'GET'
|
||||
| 'delete'
|
||||
| 'DELETE'
|
||||
| 'head'
|
||||
| 'HEAD'
|
||||
| 'options'
|
||||
| 'OPTIONS'
|
||||
| 'post'
|
||||
| 'POST'
|
||||
| 'put'
|
||||
| 'PUT'
|
||||
| 'patch'
|
||||
| 'PATCH'
|
||||
| 'purge'
|
||||
| 'PURGE'
|
||||
| 'link'
|
||||
| 'LINK'
|
||||
| 'unlink'
|
||||
| 'UNLINK';
|
||||
type UppercaseMethod = "GET" | "DELETE" | "HEAD" | "OPTIONS" | "POST" | "PUT" | "PATCH" | "PURGE" | "LINK" | "UNLINK";
|
||||
|
||||
type Method = (UppercaseMethod | Lowercase<UppercaseMethod>) & {};
|
||||
|
||||
type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream' | 'formdata';
|
||||
|
||||
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';
|
||||
type UppercaseResponseEncoding = "ASCII" | "ANSI" | "BINARY" | "BASE64" | "BASE64URL" | "HEX" | "LATIN1" | "UCS-2" | "UCS2" | "UTF-8" | "UTF8" | "UTF16LE";
|
||||
|
||||
type responseEncoding = (UppercaseResponseEncoding | Lowercase<UppercaseResponseEncoding>) & {};
|
||||
|
||||
interface TransitionalOptions {
|
||||
silentJSONParsing?: boolean;
|
||||
|
||||
Vendored
+6
-46
@@ -272,27 +272,9 @@ export enum HttpStatusCode {
|
||||
NetworkAuthenticationRequired = 511,
|
||||
}
|
||||
|
||||
export type Method =
|
||||
| "get"
|
||||
| "GET"
|
||||
| "delete"
|
||||
| "DELETE"
|
||||
| "head"
|
||||
| "HEAD"
|
||||
| "options"
|
||||
| "OPTIONS"
|
||||
| "post"
|
||||
| "POST"
|
||||
| "put"
|
||||
| "PUT"
|
||||
| "patch"
|
||||
| "PATCH"
|
||||
| "purge"
|
||||
| "PURGE"
|
||||
| "link"
|
||||
| "LINK"
|
||||
| "unlink"
|
||||
| "UNLINK";
|
||||
type UppercaseMethod = "GET" | "DELETE" | "HEAD" | "OPTIONS" | "POST" | "PUT" | "PATCH" | "PURGE" | "LINK" | "UNLINK";
|
||||
|
||||
export type Method = (UppercaseMethod | Lowercase<UppercaseMethod>) & {};
|
||||
|
||||
export type ResponseType =
|
||||
| "arraybuffer"
|
||||
@@ -303,31 +285,9 @@ export type ResponseType =
|
||||
| "stream"
|
||||
| "formdata";
|
||||
|
||||
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";
|
||||
type UppercaseResponseEncoding = "ASCII" | "ANSI" | "BINARY" | "BASE64" | "BASE64URL" | "HEX" | "LATIN1" | "UCS-2" | "UCS2" | "UTF-8" | "UTF8" | "UTF16LE";
|
||||
|
||||
export type responseEncoding = (UppercaseResponseEncoding | Lowercase<UppercaseResponseEncoding>) & {};
|
||||
|
||||
export interface TransitionalOptions {
|
||||
silentJSONParsing?: boolean;
|
||||
|
||||
Reference in New Issue
Block a user