fix: resolve readonly project type issue in AppHeader.vue

Create mutable copy of currentProject from Pinia store to satisfy type
requirements. The readonly deep object from the store has readonly tasks
array which is incompatible with IProject type.

Fixes TypeScript errors on lines 25 and 40 where readonly project was
passed to getProjectTitle() and ProjectSettingsDropdown component.

Related to issue #29 from TYPECHECK_ISSUES.md
This commit is contained in:
kolaente
2025-11-22 15:35:47 +01:00
parent f67af55204
commit 658946b029

View File

@@ -133,9 +133,14 @@ import { isEditorContentEmpty } from '@/helpers/editorContentEmpty'
import { useBaseStore } from '@/stores/base'
import { useConfigStore } from '@/stores/config'
import { useAuthStore } from '@/stores/auth'
import type { IProject } from '@/modelTypes/IProject'
const baseStore = useBaseStore()
const currentProject = computed(() => baseStore.currentProject)
// Create a mutable copy to satisfy type requirements (readonly deep -> mutable)
const currentProject = computed<IProject | null>(() => {
const project = baseStore.currentProject
return project ? { ...project } as IProject : null
})
const background = computed(() => baseStore.background)
const canWriteCurrentProject = computed(() => baseStore.currentProject?.maxPermission !== null && baseStore.currentProject?.maxPermission !== undefined && baseStore.currentProject.maxPermission > Permissions.READ)
const menuActive = computed(() => baseStore.menuActive)