From 9e26b57e2cb67348827bf372453134ea8e2ec3a1 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 30 Jan 2023 18:11:27 +0800 Subject: [PATCH] fix(nc-gui): type issues --- packages/nc-gui/composables/useKanbanViewStore.ts | 4 +++- packages/nc-gui/composables/useSmartsheetStore.ts | 5 ++++- packages/nc-gui/composables/useViewData.ts | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/nc-gui/composables/useKanbanViewStore.ts b/packages/nc-gui/composables/useKanbanViewStore.ts index f39675e9fd..9136f6ddfa 100644 --- a/packages/nc-gui/composables/useKanbanViewStore.ts +++ b/packages/nc-gui/composables/useKanbanViewStore.ts @@ -71,7 +71,9 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState( const { sqlUis } = useProject() - const sqlUi = ref(meta.value?.base_id ? sqlUis.value[meta.value?.base_id] : Object.values(sqlUis.value)[0]) + const sqlUi = ref( + (meta.value as TableType)?.base_id ? sqlUis.value[(meta.value as TableType)?.base_id!] : Object.values(sqlUis.value)[0], + ) const xWhere = computed(() => { let where diff --git a/packages/nc-gui/composables/useSmartsheetStore.ts b/packages/nc-gui/composables/useSmartsheetStore.ts index d76791a360..6dd7218516 100644 --- a/packages/nc-gui/composables/useSmartsheetStore.ts +++ b/packages/nc-gui/composables/useSmartsheetStore.ts @@ -13,9 +13,12 @@ const [useProvideSmartsheetStore, useSmartsheetStore] = useInjectionState( initialFilters?: Ref, ) => { const { $api } = useNuxtApp() + const { sqlUis } = useProject() - const sqlUi = ref(meta.value?.base_id ? sqlUis.value[meta.value?.base_id] : Object.values(sqlUis.value)[0]) + const sqlUi = ref( + (meta.value as TableType)?.base_id ? sqlUis.value[(meta.value as TableType)?.base_id!] : Object.values(sqlUis.value)[0], + ) const cellRefs = ref([]) diff --git a/packages/nc-gui/composables/useViewData.ts b/packages/nc-gui/composables/useViewData.ts index 1b54fb63fd..670eead85b 100644 --- a/packages/nc-gui/composables/useViewData.ts +++ b/packages/nc-gui/composables/useViewData.ts @@ -511,7 +511,7 @@ export function useViewData( order: (fieldById[c.id] && fieldById[c.id].order) || order++, id: fieldById[c.id] && fieldById[c.id].id, })) - .sort((a: Record, b: Record) => a.order - b.order) as Record + .sort((a: Record, b: Record) => a.order - b.order) as Record[] } catch (e: any) { return message.error(`${t('msg.error.setFormDataFailed')}: ${await extractSdkResponseErrorMsg(e)}`) }