Skip to content

Commit

Permalink
CHE-120 added typing to post-reply to pass tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Howard Sun committed Jun 17, 2024
1 parent 613da2d commit 2881ae7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const ThreadDetail = ({ forumId, threadId }: ThreadDetailProps) => {
}
};

const totalPosts = posts.length + 1;
const totalPosts: number = posts.length + 1;

if (loading) return <div>Loading...</div>;
if (error) return <div>Error: {error}</div>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const ThreadsDisplay = ({ forumId, onThreadSelect }: ThreadsDisplayProps) => {
setCreatingThread(!creatingThread);
};

function formatReplies(count) {
function formatReplies(count: number) {
if (count === 0) return 'No replies';
if (count === 1) return '1 reply';
return `${count} replies`;
Expand Down
1 change: 1 addition & 0 deletions client/types/forums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface Thread {
content: string;
user: IUser;
createdAt: string;
postCount: number;
}

export interface IForum {
Expand Down

0 comments on commit 2881ae7

Please sign in to comment.