Skip to content

Commit

Permalink
fix: ts build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
CaliCastle committed Mar 13, 2024
1 parent 941050f commit 8d5ab2c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 14 deletions.
13 changes: 6 additions & 7 deletions app/admin/comments/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@ export default async function AdminCommentsPage() {
.limit(15)
// get unique post IDs from comments
const postIds = [...new Set(latestComments.map((comment) => comment.postId))]
const posts = await clientFetch<
{ _id: string; title: string; slug: string }[]
>(
`*[_type == "post" && (_id in [${postIds
.map((v) => `"${v}"`)
.join(',')}])]{ _id, title, "slug":slug.current }`
)
const posts: { _id: string; title: string; slug: string }[] =
await clientFetch(
`*[_type == "post" && (_id in [${postIds
.map((v) => `"${v}"`)
.join(',')}])]{ _id, title, "slug":slug.current }`
)
// define a map with key of post IDs to posts
const postMap = new Map(posts.map((post) => [post._id, post]))

Expand Down
2 changes: 1 addition & 1 deletion app/admin/newsletters/new/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function CreateNewsletterPage() {
const subscriberEmails = new Set([
...subs
.filter((sub) => typeof sub.email === 'string' && sub.email.length > 0)
.map((sub) => sub.email!),
.map((sub) => sub.email),
])

await resend.emails.send({
Expand Down
2 changes: 1 addition & 1 deletion app/api/comments/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export async function POST(req: NextRequest, { params }: Params) {

return NextResponse.json({
...commentData,
id: CommentHashids.encode(newComment!.newId),
id: CommentHashids.encode(newComment.newId),
createdAt: new Date(),
parentId: hashedParentId,
} satisfies CommentDto)
Expand Down
3 changes: 1 addition & 2 deletions app/api/favicon/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ function getPredefinedIconForUrl(url: string): string | undefined {
`^(?:https?:\/\/)?(?:[^@/\\n]+@)?(?:www.)?` + regexStr
)
if (regex.test(url)) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return faviconMapper[regexStr]!
return faviconMapper[regexStr]
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/api/guestbook/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export async function POST(req: NextRequest) {
return NextResponse.json(
{
...guestbookData,
id: GuestbookHashids.encode(newGuestbook!.newId),
id: GuestbookHashids.encode(newGuestbook.newId),
createdAt: new Date(),
} satisfies GuestbookDto,
{
Expand Down
3 changes: 1 addition & 2 deletions components/links/SocialLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ function getIconForUrl(url: string): PlatformInfo | undefined {
`^(?:https?:\/\/)?(?:[^@/\\n]+@)?(?:www.)?` + regexStr
)
if (regex.test(url)) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return iconMapper[regexStr]!
return iconMapper[regexStr]
}
}

Expand Down

0 comments on commit 8d5ab2c

Please sign in to comment.