Skip to content

Commit

Permalink
[Tests] default-props-match-prop-types: add passing test
Browse files Browse the repository at this point in the history
Closes #1593
  • Loading branch information
ljharb committed Feb 4, 2022
1 parent 70dccbe commit 8d8ca3f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/lib/rules/default-props-match-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -1756,5 +1756,32 @@ ruleTester.run('default-props-match-prop-types', rule, {
},
],
},
{
code: `
export type SharedProps = {|
disabled: boolean,
|};
type Props = {|
...SharedProps,
focused?: boolean,
|};
class Foo extends React.Component<Props> {
static defaultProps = {
disabled: false
};
};
`,
features: ['flow'],
errors: [
{
messageId: 'requiredHasDefault',
data: {
name: 'disabled',
},
},
],
},
]),
});

0 comments on commit 8d8ca3f

Please sign in to comment.