Skip to content

Commit 522530a

Browse files
authored
Merge pull request #709 from danfitz36/fix/blog-getstaticpaths-ts6-implicit-any
fix(types): make blog getStaticPaths TypeScript 6 strict-safe
2 parents 9167087 + 9dce846 commit 522530a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/utils/blog.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { PaginateFunction } from 'astro';
22
import { getCollection, render } from 'astro:content';
33
import type { CollectionEntry } from 'astro:content';
4-
import type { Post } from '~/types';
4+
import type { Post, Taxonomy } from '~/types';
55
import { APP_BLOG } from 'astrowind:config';
66
import { cleanSlug, trimSlash, BLOG_BASE, POST_PERMALINK_PATTERN, CATEGORY_BASE, TAG_BASE } from './permalinks';
77

@@ -198,10 +198,10 @@ export const getStaticPathsBlogCategory = async ({ paginate }: { paginate: Pagin
198198
if (!isBlogEnabled || !isBlogCategoryRouteEnabled) return [];
199199

200200
const posts = await fetchPosts();
201-
const categories = {};
201+
const categories: Record<string, Taxonomy> = {};
202202
posts.map((post) => {
203203
if (post.category?.slug) {
204-
categories[post.category?.slug] = post.category;
204+
categories[post.category.slug] = post.category;
205205
}
206206
});
207207

@@ -222,11 +222,11 @@ export const getStaticPathsBlogTag = async ({ paginate }: { paginate: PaginateFu
222222
if (!isBlogEnabled || !isBlogTagRouteEnabled) return [];
223223

224224
const posts = await fetchPosts();
225-
const tags = {};
225+
const tags: Record<string, Taxonomy> = {};
226226
posts.map((post) => {
227227
if (Array.isArray(post.tags)) {
228228
post.tags.map((tag) => {
229-
tags[tag?.slug] = tag;
229+
tags[tag.slug] = tag;
230230
});
231231
}
232232
});

0 commit comments

Comments
 (0)