11---
2- import type { GetStaticPaths } from ' astro' ;
3- import { getCollection , getEntry , render } from ' astro:content' ;
2+ import type { GetStaticPaths , InferGetStaticPropsType } from ' astro' ;
3+ import { getCollection , render } from ' astro:content' ;
44
55import { FilterableToolsList } from ' @/components/filters/FilterableToolsList' ;
66import Link from ' @/components/Link' ;
@@ -20,13 +20,15 @@ import {
2020import { isModern } from ' @/utils/versionFilters' ;
2121
2222// 1. Generate a new path for every collection entry
23- export const getStaticPaths: GetStaticPaths = async () => {
23+ export const getStaticPaths = ( async () => {
2424 const categories = await getCollection (' categories' );
2525 return categories .map ((category ) => ({
2626 params: { slug: category .id .replace (/ \. md$ / , ' ' ) },
2727 props: { category },
2828 }));
29- };
29+ }) satisfies GetStaticPaths ;
30+
31+ type Props = InferGetStaticPropsType <typeof getStaticPaths >;
3032
3133// 2. For your template, you can get the entry directly from the prop
3234const { category } = Astro .props ;
@@ -53,9 +55,7 @@ const allTools = (await getCollection('tools')).filter((tool) => {
5355 }
5456 const categories = tool .data .categories ;
5557 // Check if tool belongs to this category
56- const isInCategory = categories .some (
57- (cat ) => cat .id === categorySlug
58- );
58+ const isInCategory = categories .some ((cat ) => cat .id === categorySlug );
5959
6060 if (! isInCategory ) {
6161 return false ;
0 commit comments