diff --git a/package.json b/package.json index 6c51c27f6..7497e1638 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "typecheck": "vue-tsc --noEmit --skipLibCheck", "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts,.json --fix", "prepare": "husky install", + "postinstall": "patch-package", "release": "standard-version", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md" }, @@ -62,6 +63,7 @@ "@commitlint/config-conventional": "^17.0.3", "@iconify/json": "^2.1.87", "@iconify/vue": "^3.2.1", + "@milahu/patch-package": "^6.4.14", "@types/bmapgl": "^0.0.5", "@types/crypto-js": "^4.1.1", "@types/node": "^18.6.3", diff --git a/patches/mockjs+^1.1.0.patch b/patches/mockjs+^1.1.0.patch new file mode 100644 index 000000000..eed029a9c --- /dev/null +++ b/patches/mockjs+^1.1.0.patch @@ -0,0 +1,26 @@ +# generated by patch-package 6.4.14 +# +# declared package: +# mockjs: ^1.1.0 +# +diff --git a/node_modules/mockjs/dist/mock.js b/node_modules/mockjs/dist/mock.js +index 35d5b9a..dcc2fb9 100644 +--- a/node_modules/mockjs/dist/mock.js ++++ b/node_modules/mockjs/dist/mock.js +@@ -8310,6 +8310,8 @@ return /******/ (function(modules) { // webpackBootstrap + var xhr = createNativeXMLHttpRequest() + this.custom.xhr = xhr + ++ MockXMLHttpRequest.prototype.upload = xhr.upload ++ + // 初始化所有事件,用于监听原生 XHR 对象的事件 + for (var i = 0; i < XHR_EVENTS.length; i++) { + xhr.addEventListener(XHR_EVENTS[i], handle) +@@ -8360,6 +8362,7 @@ return /******/ (function(modules) { // webpackBootstrap + + // 原生 XHR + if (!this.match) { ++ this.custom.xhr.responseType = this.responseType || '' + this.custom.xhr.send(data) + return + } diff --git a/src/typings/utils.d.ts b/src/typings/utils.d.ts index 87550f90d..9eba0802f 100644 --- a/src/typings/utils.d.ts +++ b/src/typings/utils.d.ts @@ -5,8 +5,6 @@ declare namespace TypeUtil { type GetFunArgs = F extends (...args: infer P) => any ? P : never; - type GetFunReturn = F extends (...args: any) => infer R ? R : never; - type Writable = { [K in keyof T]: T[K] }; type FirstOfArray = T extends [infer First, ...infer _Rest] ? First : never; diff --git a/src/utils/service/handler.ts b/src/utils/service/handler.ts index 3bbc426cb..54288a0b2 100644 --- a/src/utils/service/handler.ts +++ b/src/utils/service/handler.ts @@ -18,7 +18,7 @@ export async function handleServiceResult(error: Service.RequestError | export function adapter( adapterFun: T, ...args: Service.MultiRequestResult> -): Service.RequestResult> { +): Service.RequestResult> { let result: Service.RequestResult | undefined; const hasError = args.some(item => {