fix: incorrect types now fixed

This commit is contained in:
2025-11-19 22:03:35 +01:00
parent 3c3e1b67fd
commit 355653e4f2
3 changed files with 20 additions and 14 deletions

View File

@@ -47,8 +47,8 @@ export const useDataJson = (prefix: string) => {
return data as Ref<T | null>;
};
const getJsonData = async (collectionPrefix: string = 'content_data_') => {
return getData(collectionPrefix, { useFilter: true, extractMeta: true });
const getJsonData = async <T = unknown>(collectionPrefix: string = 'content_data_') => {
return getData<T>(collectionPrefix, { useFilter: true, extractMeta: true });
};
const getPageContent = async (collectionPrefix: string = 'content_', fallbackToEnglish: boolean = true) => {

View File

@@ -35,13 +35,16 @@
</template>
<script setup lang="ts">
import { ResumeContent } from '~/types/resume';
useMeta({
title: $t('pages.resume.name'),
description: $t('pages.resume.description'),
});
const { getJsonData } = useDataJson('resume');
const resumeContent = await getJsonData();
const arrLength = (array?: T[]) => (array ? array.length - 1 : 0);
const resumeContent$ = await getJsonData<ResumeContent>();
const resumeContent = computed(() => (resumeContent$.value ? resumeContent$.value : new ResumeContent()));
const arrLength = <T,>(array?: T[]) => (array ? array.length - 1 : 0);
const valueExp = computed(() => arrLength(resumeContent.value?.experience));
const valueEd = computed(() => arrLength(resumeContent.value?.education));
</script>

View File

@@ -1,13 +1,16 @@
export interface ResumeExperience extends TimelineItem {
tools: string[];
import type { TimelineItem } from '@nuxt/ui';
export class ResumeExperience implements TimelineItem {
tools: string[] = [];
description?: string;
}
export interface ResumeContent {
experience: ResumeExperience[];
education: TimelineItem[];
otherTools: string[];
devops: string[];
os: string[];
programmingLanguages: string[];
frameworks: string[];
export class ResumeContent {
experience: ResumeExperience[] = [];
education: TimelineItem[] = [];
otherTools: string[] = [];
devops: string[] = [];
os: string[] = [];
programmingLanguages: string[] = [];
frameworks: string[] = [];
}