From c2f27d90720a1f90ab1bf431c88de79c2f443505 Mon Sep 17 00:00:00 2001 From: Matias Borghi Date: Tue, 2 Jan 2024 17:56:42 -0300 Subject: [PATCH] chore: clarify comment --- packages/react/src/components/Menu/Menu.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react/src/components/Menu/Menu.tsx b/packages/react/src/components/Menu/Menu.tsx index c0353dbf8c67..6d7903f9e9aa 100644 --- a/packages/react/src/components/Menu/Menu.tsx +++ b/packages/react/src/components/Menu/Menu.tsx @@ -286,7 +286,9 @@ const Menu = React.forwardRef(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;