Skip to content

Commit

Permalink
add a test case for boolean | undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
rayane-djouah committed Oct 9, 2024
1 parent c3505c1 commit fbbe2b2
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,23 @@ ruleTester.run('boolean-conditional-rendering', rule, {
},
],
invalid: [
{
code: `
type ComponentProps = {
condition?: boolean;
};
function Component({condition}: ComponentProps) {
return <View>{condition && <SomeComponent/>}</View>;
}
`,
errors: [
{
messageId: 'nonBooleanConditional',
data: {type: 'boolean | undefined'},
},
],
},
{
code: `
const condition = "string";
Expand Down

0 comments on commit fbbe2b2

Please sign in to comment.