diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-05-23 14:07:02 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-05-23 16:00:13 +0200 |
| commit | 34e216546151eaf8a0a3cbb0bc8b65dae4c63bf2 (patch) | |
| tree | bff34f8a1dc65f0559ddf851433f242edb092824 /src/ts | |
| parent | 0f8f963ba3eccd7fd94785bf7fb216b6287cec57 (diff) | |
refactor: reduce the number of data transformation
Diffstat (limited to 'src/ts')
| -rw-r--r-- | src/ts/types/app.ts | 5 | ||||
| -rw-r--r-- | src/ts/types/mdx.ts | 5 | ||||
| -rw-r--r-- | src/ts/types/raw-data.ts | 3 |
3 files changed, 4 insertions, 9 deletions
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<T extends PageKind> = { 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<T extends PageKind> = { 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<T extends PageKind> = { 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<Meta<'page'>, 'cover' | 'dates' | 'seo'> & { title: string; }; -export type MDXProjectMeta = Omit< - Meta<'project'>, - 'readingTime' | 'wordsCount' -> & { +export type MDXProjectMeta = Exclude<Meta<'project'>, '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<RawAuthor<'page'>>; + author?: NodeResponse<RawAuthor<'page'>>; contentParts: ContentParts; databaseId: number; date: string; |
