Skip to content

Commit

Permalink
chore: clarify comment
Browse files Browse the repository at this point in the history
  • Loading branch information
mattborghi committed Jan 2, 2024
1 parent 30bd151 commit c2f27d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/react/src/components/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ const Menu = React.forwardRef<HTMLUListElement, MenuProps>(function Menu(
max - spacing - size,
];

// cast to number since we have the fallback value.
// Previous array `options`, has at least one item that is a number (the last one - second fallback).
// That guarantees that the return of `find()` will always be a number
// and we can safely add the numeric casting `as number`.
const bestOption = options.find((option) => option !== false) as number;

return bestOption >= spacing ? bestOption : spacing;
Expand Down

0 comments on commit c2f27d9

Please sign in to comment.