Skip to content

Commit

Permalink
Fix type
Browse files Browse the repository at this point in the history
  • Loading branch information
marshallku committed Feb 16, 2025
1 parent 5631c67 commit 7eb39af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/blog/src/utils/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function formatCategoryFeed(filterFunction: (post: Post) => boolean
renderer,
});

const posts = getPosts();
const posts = getPosts(undefined, true);
const lastBuildDate = new Date().toUTCString();
const categories = getCategories();
const host = process.env.NEXT_PUBLIC_BLOG_ORIGIN;
Expand Down
7 changes: 5 additions & 2 deletions apps/blog/src/utils/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,12 @@ export function getPostsByTag(tag: string): Omit<Post, "content">[] {
return posts.filter(({ data: { tags } }) => tags?.find((x) => x.toLocaleLowerCase() === tag.toLocaleLowerCase()));
}

export function getPosts(category?: string): Omit<Post, "content">[] {
export function getPosts<T extends boolean>(
category?: string,
getContent?: T,
): (T extends true ? Post : Omit<Post, "content">)[] {
return getPostSlugs(category)
.map((slug) => getPostBySlug(slug, false)!)
.map((slug) => getPostBySlug(slug, getContent)!)
.sort((a, b) => {
if (a.data.date.posted > b.data.date.posted) {
return -1;
Expand Down

1 comment on commit 7eb39af

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Visual regression test result - success

Component Story Success Viewport MisMatch Percentage
components-button string-children phone 0.00%
components-button string-children tablet 0.10%
input-input default phone 0.00%
input-input default tablet 0.10%
input-input line phone 0.00%
input-input line tablet 0.04%
input-input box phone 0.00%
input-input box tablet 0.04%
components-profile default phone 0.00%
components-profile default tablet 0.00%
input-textarea line phone 0.00%
input-textarea line tablet 0.04%
input-textarea box phone 0.00%
input-textarea box tablet 0.04%
typography-typography default phone 0.00%
typography-typography default tablet 0.07%

Please sign in to comment.