import type { Component } from 'svelte'; export type PostMetadata = { title: string; blurb: string; author: string | null; slug: string; id: string | number; created: Parsed extends true ? Date : string; updated: Parsed extends true ? Date : string; published: boolean | 'unlisted'; /** If false (defaults to true), author panel at the bottom of the page is hidden. This is the case for the clickbait article. */ authorpanel?: boolean; }; export type Post = { metadata: PostMetadata; default: Component; }; export const parsePostMetadata = ( m: PostMetadata, ): PostMetadata => ({ ...m, created: new Date(m.created), updated: new Date(m.updated), }); export const parsePost = (p: Post): Post => ({ ...p, metadata: parsePostMetadata(p.metadata), });