From 8e25a3aa09fac18bbcceb899fd16ff8daa5743e3 Mon Sep 17 00:00:00 2001 From: xingyu Date: Mon, 23 Oct 2023 09:49:32 +0800 Subject: [PATCH] fix(BasicTree): Resolve ts type error --- src/components/Tree/src/BasicTree.vue | 5 +++-- src/components/Tree/src/TreeIcon.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/Tree/src/BasicTree.vue b/src/components/Tree/src/BasicTree.vue index 0b83a426..680abc2c 100644 --- a/src/components/Tree/src/BasicTree.vue +++ b/src/components/Tree/src/BasicTree.vue @@ -3,6 +3,7 @@ import type { CSSProperties } from 'vue' import { computed, defineComponent, onMounted, reactive, ref, toRaw, unref, watch, watchEffect } from 'vue' import { Empty, Spin, Tree } from 'ant-design-vue' import { cloneDeep, difference, get, omit } from 'lodash-es' +import type { TreeProps } from 'ant-design-vue/es/tree/Tree' import type { CheckKeys, FieldNames, KeyType, TreeActionType, TreeItem, TreeState } from './types/tree' import TreeHeader from './components/TreeHeader.vue' @@ -98,11 +99,11 @@ export default defineComponent({ const rawVal = toRaw(state.checkedKeys) emit('update:value', rawVal) - emit('check', state.checkStrictly ? rawVal.checked : rawVal, e) + emit('check', rawVal, e) }, 'onRightClick': handleRightClick, } - return omit(propsData, 'treeData', 'class') + return omit(propsData, 'treeData', 'class') as TreeProps }) const getTreeData = computed((): TreeItem[] => (searchState.startSearch ? searchState.searchData : unref(treeDataRef))) diff --git a/src/components/Tree/src/TreeIcon.ts b/src/components/Tree/src/TreeIcon.ts index aa30b036..ffc08cc9 100644 --- a/src/components/Tree/src/TreeIcon.ts +++ b/src/components/Tree/src/TreeIcon.ts @@ -10,5 +10,5 @@ export const TreeIcon: FunctionalComponent = ({ icon }: { icon: VNode | string } if (isString(icon)) return h(Icon, { icon, class: 'mr-1' }) - return Icon + return h(Icon) }