From 34e216546151eaf8a0a3cbb0bc8b65dae4c63bf2 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Mon, 23 May 2022 14:07:02 +0200 Subject: refactor: reduce the number of data transformation --- src/ts/types/app.ts | 5 ++--- src/ts/types/mdx.ts | 5 +---- src/ts/types/raw-data.ts | 3 +-- 3 files changed, 4 insertions(+), 9 deletions(-) (limited to 'src/ts') diff --git a/src/ts/types/app.ts b/src/ts/types/app.ts index feff5a5..cb5429b 100644 --- a/src/ts/types/app.ts +++ b/src/ts/types/app.ts @@ -44,7 +44,7 @@ export type Comment = { content: string; id: number; meta: CommentMeta; - parentId: number; + parentId?: number; replies: Comment[]; }; @@ -80,7 +80,6 @@ export type Meta = { cover?: Image; dates: Dates; license?: T extends 'project' ? string : never; - readingTime?: number; repos?: T extends 'project' ? Repos : never; seo: SEO; tagline?: T extends 'project' ? string : never; @@ -88,7 +87,7 @@ export type Meta = { thematics?: T extends 'article' | 'topic' ? PageLink[] : never; topics?: T extends 'article' | 'thematic' ? PageLink[] : never; website?: T extends 'topic' ? string : never; - wordsCount?: number; + wordsCount: number; }; export type Page = { diff --git a/src/ts/types/mdx.ts b/src/ts/types/mdx.ts index 6b72f21..16538c1 100644 --- a/src/ts/types/mdx.ts +++ b/src/ts/types/mdx.ts @@ -11,10 +11,7 @@ export type MDXPageMeta = Pick, 'cover' | 'dates' | 'seo'> & { title: string; }; -export type MDXProjectMeta = Omit< - Meta<'project'>, - 'readingTime' | 'wordsCount' -> & { +export type MDXProjectMeta = Exclude, 'wordsCount'> & { intro: string; title: string; }; diff --git a/src/ts/types/raw-data.ts b/src/ts/types/raw-data.ts index ba6d596..dc3db90 100644 --- a/src/ts/types/raw-data.ts +++ b/src/ts/types/raw-data.ts @@ -25,7 +25,6 @@ export type ContentParts = { }; export type Info = { - readingTime: number; wordsCount: number; }; @@ -66,7 +65,7 @@ export type RawArticlePreview = Pick< >; export type RawPage = { - author: NodeResponse>; + author?: NodeResponse>; contentParts: ContentParts; databaseId: number; date: string; -- cgit v1.2.3