Skip to content

Commit 25526b6

Browse files
committed
chore: fix types on project pages
1 parent 79bdefb commit 25526b6

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

src/pages/projects/[...slug].astro

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,25 @@ import BaseLayout from '../../layouts/base.astro'
44
import Join from '../../components/join.astro'
55
import MarkdownContent from '../../components/markdown-content.astro'
66
import { getCollection, render } from 'astro:content'
7+
import type keystaticConfig from '../../../keystatic.config'
8+
import type { Entry } from '@keystatic/core/reader'
9+
10+
type Replace<T, K extends keyof T, V> = Omit<T, K> & {
11+
[key in K]: V
12+
}
713
814
export async function getStaticPaths() {
915
const projectEntries = await getCollection('projects', ({ data }) => {
1016
return import.meta.env.PROD ? data.draft !== true : true
1117
})
1218
13-
return projectEntries.map((entry) => ({
14-
params: { slug: entry.id },
15-
props: { entry },
16-
}))
19+
return projectEntries.map((e) => {
20+
const entry: Replace<typeof e, 'data', Entry<typeof keystaticConfig['collections']['projects']>> = e
21+
return {
22+
params: { slug: entry.id },
23+
props: { entry },
24+
}
25+
})
1726
}
1827
const { entry } = Astro.props
1928
const { Content } = await render(entry)

0 commit comments

Comments
 (0)