Confusing boolean expressions for selected and focus props in Options components
Problem The following pattern appears in multiple places:
selected={selected || (multiple !== true && undefined)}
focus={cursor === i || undefined}
This is hard to read, causes TypeScript warnings, and introduces TODO/FIXME comments.
Expected Behavior Clear, type-safe logic No TODO/FIXME comments No runtime change
Actual Behavior Boolean logic mixes || and && TypeScript infers boolean | undefined Requires inline comments to justify behavior
Proposed Fix Replace with explicit ternary expressions:
selected={selected ? true : undefined}
focus={cursor === i ? true : undefined}
Why This Is Safe Runtime behavior is identical Improves readability Removes TypeScript ambiguity
Scope Options.tsx OptionsPaginated.tsx
Hi @abhi-7-7, I’d like to work on this issue and submit a PR.
I’ll update Options.tsx and OptionsPaginated.tsx to replace the current boolean expressions with explicit ternary expressions as suggested, ensuring there’s no runtime behavior change while improving readability and TypeScript type safety.
Please let me know if that sounds good. Thanks!
@tassoevan I've successfully fixed the boolean logic issue in the Options components. Please assign this issue to me than i will test it and open a PR for my changed file. Thanks!