mirror of
https://github.com/quartz-community/tag-page.git
synced 2026-07-22 02:50:25 +00:00
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:
parent
07356718ca
commit
e067fe76f2
3 changed files with 6 additions and 13 deletions
2
dist/components/index.js.map
vendored
2
dist/components/index.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue