From a5ce6ab200e5557d0909827992c5358f3160749f Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Wed, 29 Jul 2026 13:46:22 +0530 Subject: [PATCH] docs(types): rewrite JSDoc comments in shared.d.ts Standardizes the tone across the file and documents all previously undocumented types and members. Co-Authored-By: Claude Fable 5 --- types/shared.d.ts | 369 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 327 insertions(+), 42 deletions(-) diff --git a/types/shared.d.ts b/types/shared.d.ts index 4eb2ba6b..0d8105c5 100644 --- a/types/shared.d.ts +++ b/types/shared.d.ts @@ -4,9 +4,16 @@ import type { Component, Ref } from 'vue' import type { SSRContext } from 'vue/server-renderer' export type { DefaultTheme } from './default-theme.js' +/** + * A value of type `T`, or a promise resolving to it. + */ export type Awaitable = T | PromiseLike -type DeepPartial = +/** + * Recursively makes all properties of `T` optional, leaving non-plain + * objects (dates, regexps, functions, collections) as-is. + */ +export type DeepPartial = T extends Record ? T extends | Date @@ -19,67 +26,105 @@ type DeepPartial = : { [P in keyof T]?: DeepPartial } : T +/** + * The data of a page, available on both server and client. + */ export interface PageData { + /** + * The path of the page relative to the source directory, with rewrites + * applied. Determines the URL of the page. + */ relativePath: string /** - * differs from relativePath in case of path rewrites - * empty string if the page is virtual (e.g. 404 page) + * The path of the actual source file relative to the source directory. + * Differs from `relativePath` when path rewrites are in use, points to + * the route template for dynamic routes, and is an empty string if the + * page is virtual (e.g. the 404 page). */ filePath: string + /** + * The title of the page, from its frontmatter or its first level-1 + * heading. + */ title: string + /** + * The suffix appended to the title (`title | suffix`), or a template + * containing the `:title` token. Set to `false` to use the title as-is. + */ titleTemplate?: string | boolean + /** + * The description of the page, from its frontmatter. + */ description: string + /** + * The section headers extracted from the page. + */ headers: Header[] + /** + * The frontmatter of the page. + */ frontmatter: Record + /** + * The route params of the page, if it belongs to a dynamic route. + */ params?: Record + /** + * Whether the page is the not-found (404) page. + */ isNotFound?: boolean + /** + * The timestamp (in milliseconds) of the last update, from the page's + * frontmatter or its last git commit. + */ lastUpdated?: number } /** - * SFC block extracted from markdown + * A block of the Vue SFC generated from a markdown source file. */ export interface SfcBlock { /** - * The type of the block + * The type of the block. */ type: string /** - * The content, including open-tag and close-tag + * The content of the block, including its open and close tags. */ content: string /** - * The content that stripped open-tag and close-tag off + * The content of the block, with its open and close tags stripped. */ contentStripped: string /** - * The open-tag + * The open tag of the block. */ tagOpen: string /** - * The close-tag + * The close tag of the block. */ tagClose: string } +/** + * The SFC blocks extracted from a markdown source file. + */ export interface MarkdownSfcBlocks { /** - * The `