From 63064bb699df0f30f53c6c4e87e8ea0869b797e2 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Sat, 9 Jul 2022 23:34:17 +0530 Subject: [PATCH] refactor(gui-v2): use same array definition syntax Signed-off-by: Pranav C --- packages/nc-gui-v2/composables/useProject.ts | 2 +- packages/nc-gui-v2/composables/useTabs.ts | 2 +- packages/nc-gui-v2/composables/useViewData.ts | 6 +++--- packages/nc-gui-v2/composables/useViews.ts | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/nc-gui-v2/composables/useProject.ts b/packages/nc-gui-v2/composables/useProject.ts index c0f4525fcc..013c0bc74d 100644 --- a/packages/nc-gui-v2/composables/useProject.ts +++ b/packages/nc-gui-v2/composables/useProject.ts @@ -5,7 +5,7 @@ export default () => { const { $api } = useNuxtApp() const project = useState('project') - const tables = useState>('tables') + const tables = useState('tables') const loadTables = async () => { if (project.value.id) { diff --git a/packages/nc-gui-v2/composables/useTabs.ts b/packages/nc-gui-v2/composables/useTabs.ts index 19175e5f0b..a248877449 100644 --- a/packages/nc-gui-v2/composables/useTabs.ts +++ b/packages/nc-gui-v2/composables/useTabs.ts @@ -7,7 +7,7 @@ export interface TabItem { } export default () => { - const tabs = useState>('tabs', () => []) + const tabs = useState('tabs', () => []) const activeTab = useState('activeTab', () => 0) const addTab = (tabMeta: TabItem) => { diff --git a/packages/nc-gui-v2/composables/useViewData.ts b/packages/nc-gui-v2/composables/useViewData.ts index f0051eab80..f67fbbe6b7 100644 --- a/packages/nc-gui-v2/composables/useViewData.ts +++ b/packages/nc-gui-v2/composables/useViewData.ts @@ -4,7 +4,7 @@ import { useNuxtApp } from '#app' import useProject from '~/composables/useProject' import { NOCO } from '~/lib/constants' -const formatData = (list: Array>) => +const formatData = (list: Record[]) => list.map((row) => ({ row: { ...row }, oldRow: { ...row }, @@ -15,8 +15,8 @@ export default ( meta: Ref | ComputedRef | undefined, viewMeta: Ref | ComputedRef | undefined, ) => { - const data = ref>>() - const formattedData = ref; oldRow: Record; rowMeta?: any }>>() + const data = ref[]>() + const formattedData = ref<{ row: Record; oldRow: Record; rowMeta?: any }[]>() const paginationData = ref({ page: 1, pageSize: 25 }) const { project } = useProject() diff --git a/packages/nc-gui-v2/composables/useViews.ts b/packages/nc-gui-v2/composables/useViews.ts index e531740dd2..b540b20794 100644 --- a/packages/nc-gui-v2/composables/useViews.ts +++ b/packages/nc-gui-v2/composables/useViews.ts @@ -3,12 +3,12 @@ import type { Ref } from 'vue' import { useNuxtApp } from '#app' export default function (meta: Ref) { - const views = ref>() + const views = ref<(GridType | FormType | KanbanType | GalleryType)[]>() const { $api } = useNuxtApp() const loadViews = async () => { if (meta.value?.id) - views.value = (await $api.dbView.list(meta.value?.id)).list as Array + views.value = (await $api.dbView.list(meta.value?.id)).list as (GridType | FormType | KanbanType | GalleryType)[] } return { views, loadViews }