refactor: use QuartzPluginData for PageFileData instead of duplicated shape

Replace the hand-written PageFileData interface with an intersection
of QuartzPluginData and Record<string, unknown>. This keeps
PageFileData structurally aligned with the upstream contract so future
DataMap additions (e.g. the FullSlug branding that prompted the
previous cast) do not require boundary casts on listProps.allFiles.

The interface-extends form previously tried in PageList.tsx (removed
in commit b707032 because it broke DTS builds) is not used here; the
intersection type alias inlines cleanly into the generated .d.ts.
This commit is contained in:
saberzero1 2026-04-16 15:18:20 +02:00
parent 07356718ca
commit e067fe76f2
No known key found for this signature in database
3 changed files with 6 additions and 13 deletions

File diff suppressed because one or more lines are too long

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View file

@ -2,6 +2,7 @@ import type {
QuartzComponent,
QuartzComponentConstructor,
QuartzComponentProps,
QuartzPluginData,
SortFn,
} from "@quartz-community/types";
import { PageList } from "./PageList";
@ -29,15 +30,7 @@ function concatenateResources(
return result.length === 0 ? undefined : result;
}
interface PageFileData {
slug?: string;
filePath?: string;
unlisted?: boolean;
frontmatter?: { title?: string; tags?: string[]; cssclasses?: string[] };
description?: unknown;
htmlAst?: Root;
[key: string]: unknown;
}
type PageFileData = QuartzPluginData & Record<string, unknown>;
function isListed(file: PageFileData): boolean {
return file.unlisted !== true;
@ -96,7 +89,7 @@ export default ((opts?: Partial<TagContentOptions>) => {
const pages = tagItemMap.get(t)!;
const listProps = {
...props,
allFiles: pages as unknown as QuartzComponentProps["allFiles"],
allFiles: pages,
};
const pageListContent = PageList({
...listProps,
@ -151,7 +144,7 @@ export default ((opts?: Partial<TagContentOptions>) => {
const pages = allPagesWithTag(tag);
const listProps = {
...props,
allFiles: pages as unknown as QuartzComponentProps["allFiles"],
allFiles: pages,
};
const pageListContent = PageList({
...listProps,