From be0b641f366c0fc5484fafa4cb7403a2526ad838 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Mon, 19 Sep 2022 12:20:45 +0200 Subject: [PATCH] chore(nc-gui): add generic to narrow roles type --- packages/nc-gui/composables/useProject.ts | 4 ++-- packages/nc-gui/composables/useUIPermission/index.ts | 2 +- packages/nc-gui/lib/types.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/nc-gui/composables/useProject.ts b/packages/nc-gui/composables/useProject.ts index f5b728d4f0..30d075961f 100644 --- a/packages/nc-gui/composables/useProject.ts +++ b/packages/nc-gui/composables/useProject.ts @@ -16,7 +16,7 @@ import { useTheme, watch, } from '#imports' -import type { ProjectMetaInfo, Roles } from '~/lib' +import type { ProjectMetaInfo, ProjectRole, Roles } from '~/lib' import type { ThemeConfig } from '@/composables/useTheme' const [setup, use] = useInjectionState((_projectId?: MaybeRef) => { @@ -36,7 +36,7 @@ const [setup, use] = useInjectionState((_projectId?: MaybeRef) => { const tables = ref([]) - const projectRoles = useState(USER_PROJECT_ROLES, () => ({})) + const projectRoles = useState>(USER_PROJECT_ROLES, () => ({})) const projectMetaInfo = ref() diff --git a/packages/nc-gui/composables/useUIPermission/index.ts b/packages/nc-gui/composables/useUIPermission/index.ts index 72ddd52c7a..7140957480 100644 --- a/packages/nc-gui/composables/useUIPermission/index.ts +++ b/packages/nc-gui/composables/useUIPermission/index.ts @@ -7,7 +7,7 @@ import type { ProjectRole, Role, Roles } from '~/lib' export function useUIPermission() { const { user, previewAs } = useGlobal() - const projectRoles = useState(USER_PROJECT_ROLES, () => ({})) + const projectRoles = useState>(USER_PROJECT_ROLES, () => ({})) const baseRoles = computed(() => { let userRoles = user.value?.roles diff --git a/packages/nc-gui/lib/types.ts b/packages/nc-gui/lib/types.ts index c7d1859424..6a8e509532 100644 --- a/packages/nc-gui/lib/types.ts +++ b/packages/nc-gui/lib/types.ts @@ -31,7 +31,7 @@ export interface Field { system?: boolean } -export type Roles = Record +export type Roles = Record export type Filter = FilterType & { status?: 'update' | 'delete' | 'create'; parentId?: string; readOnly?: boolean }