fixed type errors
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Cloudyy 2024-01-24 18:52:50 -03:00
parent ab405f6e45
commit 804e00a6db
Signed by: cloudyy
GPG key ID: 035104A645BAEADD
3 changed files with 6 additions and 4 deletions

BIN
bun.lockb

Binary file not shown.

View file

@ -25,8 +25,10 @@
"typescript": "^5.3.3"
},
"devDependencies": {
"@types/markdown-it": "^13.0.7",
"@types/node": "^20.11.2",
"@types/rss": "^0.0.32",
"@types/sanitize-html": "^2.9.5",
"prettier": "^3.2.2"
}
}

View file

@ -1,11 +1,11 @@
import rss from '@astrojs/rss';
import rss, { type RSSFeedItem } from '@astrojs/rss';
import { getCollection } from 'astro:content';
import sanitizeHtml from 'sanitize-html';
import MarkdownIt from 'markdown-it';
const parser = new MarkdownIt();
export async function GET(context) {
export async function GET(context: { site: any; }) {
const posts = await getCollection('posts');
return rss({
@ -14,9 +14,9 @@ export async function GET(context) {
site: context.site,
items: posts.map((post) => ({
title: post.data.title,
pubDate: post.data.date,
pubDate: new Date(post.data.date),
content: sanitizeHtml(parser.render(post.body)),
link: `/posts/${post.slug}`,
})),
})) as RSSFeedItem[],
});
}