diff --git a/packages/content/types/content.d.ts b/packages/content/types/content.d.ts index 04249b8e3..7c8251d76 100644 --- a/packages/content/types/content.d.ts +++ b/packages/content/types/content.d.ts @@ -3,11 +3,22 @@ import type { QueryBuilder } from './query-builder' export type contentFunc = (...args: Array) => QueryBuilder; -export interface IContentDocument extends Record { +export interface IContentDocumentBase extends Record { dir: string; path: string; extension: '.md' | '.json' | '.yaml' | '.xml' | '.csv' | string; slug: string; + createdAt: Date | string; + updatedAt: Date | string; + body?: object; + toc?: { + id: string; + depth: number; + text: string; + }[]; +} + +export interface IContentDocument extends IContentDocumentBase { createdAt: Date; updatedAt: Date; } diff --git a/packages/content/types/query-builder.d.ts b/packages/content/types/query-builder.d.ts index 588b4991b..b460a60ce 100644 --- a/packages/content/types/query-builder.d.ts +++ b/packages/content/types/query-builder.d.ts @@ -1,4 +1,5 @@ -import type { IContentDocument } from './content'; +import type { IContentDocumentBase } from "./content"; + interface QueryBuilderOptions { query: any; path: string; @@ -7,6 +8,11 @@ interface QueryBuilderOptions { postprocess?: any[]; } +interface FetchReturn extends IContentDocumentBase { + createdAt: string; + updatedAt: string; +} + export class QueryBuilder { constructor( { query, path, init, text, postprocess }: QueryBuilderOptions, @@ -77,6 +83,6 @@ export class QueryBuilder { * Collect data and apply process filters * @returns processed data */ - fetch(): Promise; - fetch(): Promise<(T & IContentDocument) | (T & IContentDocument)[]>; + fetch(): Promise; + fetch(): Promise<(T & FetchReturn) | (T & FetchReturn)[]>; }