Skip to content

Commit 15be26b

Browse files
committed
more parsing
1 parent 6a9d835 commit 15be26b

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/project/types/book/book-config.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,8 @@ import { RenderFlags } from "../../../command/render/types.ts";
118118
import { formatLanguage } from "../../../core/language.ts";
119119
import { kComments } from "../../../format/html/format-html-shared.ts";
120120
import { resolvePageFooter } from "../website/website-shared.ts";
121-
import {
122-
NavigationItemObject,
123-
PageFooterRegion,
124-
} from "../../../resources/types/schema-types.ts";
121+
import { Zod } from "../../../resources/types/zod/schema-types.ts";
122+
import { PageFooterRegion } from "../../../resources/types/schema-types.ts";
125123
import { projectType } from "../project-types.ts";
126124
import { BookRenderItem, BookRenderItemType } from "./book-types.ts";
127125
import { isAbsoluteRef } from "../../../core/http.ts";
@@ -145,7 +143,7 @@ export async function bookProjectConfig(
145143
if (!site[kSiteFavicon]) {
146144
const brand = await project.resolveBrand();
147145
if (brand?.light) {
148-
site[kSiteFavicon] = getFavicon(brand.light); //
146+
site[kSiteFavicon] = getFavicon(brand.light); //
149147
}
150148
}
151149
site[kSiteUrl] = book[kSiteUrl];
@@ -259,13 +257,12 @@ export async function bookProjectConfig(
259257
const footerFiles: string[] = [];
260258
const pageFooter = resolvePageFooter(config);
261259
const addFooterItems = (region?: PageFooterRegion) => {
262-
if (region) {
263-
for (const item of region) {
264-
if (typeof item !== "string") {
265-
const navItem = item as NavigationItemObject;
266-
if (navItem.href && !isAbsoluteRef(navItem.href)) {
267-
footerFiles.push(navItem.href);
268-
}
260+
if (!region) return;
261+
for (const item of region) {
262+
if (typeof item !== "string") {
263+
const navItem = Zod.NavigationItemObject.parse(item);
264+
if (navItem.href && !isAbsoluteRef(navItem.href)) {
265+
footerFiles.push(navItem.href);
269266
}
270267
}
271268
}

0 commit comments

Comments
 (0)