Skip to content

Commit

Permalink
fix: remove unused ?? in getNextMonth (#2275)
Browse files Browse the repository at this point in the history
Remove unhittable `??` in `getNextMonth.ts`

Found by microsoft/TypeScript#59217. `numberOfMonths` can't be `undefined` (it's defaulted to `1` at declaration), and `monthsDiff < numberOfMonths ?? 1` is a syntactic mistake anyway (it parses as `(m < n) ?? 1`, not `m < (n ?? 1)`

Co-authored-by: Giampaolo Bellavite <[email protected]>
  • Loading branch information
RyanCavanaugh and gpbl authored Jul 16, 2024
1 parent 70cd65e commit 014f83c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/helpers/getNextMonth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function getNextMonth(
firstDisplayedMonth
);

if (monthsDiff < numberOfMonths ?? 1) {
if (monthsDiff < numberOfMonths) {
return undefined;
}

Expand Down

0 comments on commit 014f83c

Please sign in to comment.