Skip to content

Commit 9dea9b0

Browse files
committed
Fix typescript errors
1 parent c72e2f0 commit 9dea9b0

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

app/profile/[login]/ranks/utils/get-best-rank-type.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
import { RankingType } from '@/types/ranking.types';
22

33
export function getBestRankType(params: {
4-
ownedStars?: number;
5-
contributedStars?: number;
6-
followersCount?: number;
4+
ownedStars?: number | null;
5+
contributedStars?: number | null;
6+
followersCount?: number | null;
77
}): RankingType {
8-
const { ownedStars = Infinity, contributedStars = Infinity, followersCount = Infinity } = params;
8+
const { ownedStars, contributedStars, followersCount } = params;
99

10-
if (ownedStars < contributedStars && ownedStars < followersCount) {
10+
if (
11+
(ownedStars || Infinity) < (contributedStars || Infinity) &&
12+
(ownedStars || Infinity) < (followersCount || Infinity)
13+
) {
1114
return RankingType.Star;
1215
}
1316

14-
if (contributedStars < followersCount) {
17+
if ((contributedStars || Infinity) < (followersCount || Infinity)) {
1518
return RankingType.Contribution;
1619
}
1720

0 commit comments

Comments
 (0)