Back to all reviewers

Use nullish coalescing

RooCodeInc/Roo-Code
Based on 3 comments
TSX

When providing default values for numeric properties, use the nullish coalescing operator (??) instead of logical OR (||). This ensures that valid zero values are preserved rather than being replaced with defaults. Using || will treat 0 as a falsy value and replace it with the default, which is often unintended behavior for numeric settings.

Null Handling TSX

Reviewer Prompt

When providing default values for numeric properties, use the nullish coalescing operator (??) instead of logical OR (   ). This ensures that valid zero values are preserved rather than being replaced with defaults. Using   will treat 0 as a falsy value and replace it with the default, which is often unintended behavior for numeric settings.

This pattern is especially important for numeric configurations like thresholds, ranges, and input values where zero is a valid and meaningful value that should not be overridden.

3
Comments Analyzed
TSX
Primary Language
Null Handling
Category

Source Discussions