Skip to content

Commit

Permalink
fix(utils): [is] always false of isPromise #107
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Jul 13, 2022
1 parent 4700ecd commit ec9a6b7
Show file tree
Hide file tree
Showing 3 changed files with 272 additions and 200 deletions.
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@
},
"dependencies": {
"@ant-design/icons-vue": "~6.1.0",
"@vueuse/core": "~8.9.0",
"ant-design-vue": "3.2.9",
"@vueuse/core": "~8.9.2",
"ant-design-vue": "3.2.10",
"axios": "~0.27.2",
"core-js": "~3.23.3",
"core-js": "~3.23.4",
"dayjs": "~1.11.3",
"file-saver": "~2.0.5",
"lodash-es": "~4.17.21",
"mitt": "~3.0.0",
"mockjs": "~1.1.0",
"nprogress": "~1.0.0-1",
"pinia": "2.0.14",
"pinia": "~2.0.16",
"qs": "~6.11.0",
"socket.io-client": "4.5.1",
"socket.io-client": "~4.5.1",
"sortablejs": "~1.15.0",
"vue": "3.2.37",
"vue-i18n": "9.2.0-beta.30",
Expand All @@ -60,13 +60,13 @@
"@types/lodash-es": "~4.17.6",
"@types/node": "~18.0.3",
"@types/webpack-env": "~1.17.0",
"@typescript-eslint/eslint-plugin": "~5.30.5",
"@typescript-eslint/parser": "~5.30.5",
"@vue/cli-plugin-babel": "~5.0.7",
"@vue/cli-plugin-eslint": "~5.0.7",
"@vue/cli-plugin-router": "~5.0.7",
"@vue/cli-plugin-typescript": "~5.0.7",
"@vue/cli-service": "~5.0.7",
"@typescript-eslint/eslint-plugin": "~5.30.6",
"@typescript-eslint/parser": "~5.30.6",
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-eslint": "~5.0.8",
"@vue/cli-plugin-router": "~5.0.8",
"@vue/cli-plugin-typescript": "~5.0.8",
"@vue/cli-service": "~5.0.8",
"@vue/eslint-config-typescript": "~11.0.0",
"babel-plugin-import": "~1.13.5",
"conventional-changelog-cli": "~2.2.2",
Expand All @@ -81,16 +81,16 @@
"husky": "~8.0.1",
"less": "~4.1.3",
"less-loader": "11.0.0",
"lint-staged": "~13.0.3",
"lint-staged": "~12.5.0",
"path-browserify": "~1.0.1",
"postcss-html": "~1.4.1",
"postcss-html": "~1.5.0",
"postcss-less": "~6.0.0",
"prettier": "~2.7.1",
"pretty-quick": "~3.1.3",
"regenerator-runtime": "~0.13.9",
"speed-measure-webpack-plugin": "~1.5.0",
"stylelint": "~14.9.1",
"stylelint-config-html": "~1.0.0",
"stylelint-config-html": "~1.1.0",
"stylelint-config-prettier": "~9.0.3",
"stylelint-config-recommended": "~8.0.0",
"stylelint-config-recommended-vue": "~1.4.0",
Expand All @@ -99,7 +99,7 @@
"svg-sprite-loader": "~6.0.11",
"typescript": "~4.7.4",
"unplugin-vue-define-options": "~0.6.2",
"vue-cli-plugin-windicss": "~1.1.4",
"vue-cli-plugin-windicss": "~1.1.6",
"vue-eslint-parser": "~9.0.3"
},
"__npminstall_done": false,
Expand Down
6 changes: 5 additions & 1 deletion src/utils/is/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ export function isNumber(val: unknown): val is number {
}

export function isPromise<T = any>(val: unknown): val is Promise<T> {
return is(val, 'Promise') && isObject(val) && isFunction(val.then) && isFunction(val.catch);
return (
is(val, 'Promise') &&
val instanceof Promise &&
[val.then, val.catch, val.finally].every(isFunction)
);
}

export function isString(val: unknown): val is string {
Expand Down

1 comment on commit ec9a6b7

@vercel
Copy link

@vercel vercel bot commented on ec9a6b7 Jul 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vue3-antd-admin – ./

vue3-antd-admin-git-main-buqiyuan.vercel.app
vue3-antd-admin-buqiyuan.vercel.app
vue3-antd-admin.vercel.app

Please sign in to comment.