Skip to content

Commit 4eb9259

Browse files
committed
Create failing prop-type test with union flowtypes
1 parent 6829c5c commit 4eb9259

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/lib/rules/prop-types.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,28 @@ ruleTester.run('prop-types', rule, {
11291129
'}'
11301130
].join('\n'),
11311131
parser: 'babel-eslint'
1132+
}, {
1133+
code: [
1134+
'type PropsUnionA = {',
1135+
' a: string,',
1136+
' b?: void,',
1137+
'};',
1138+
'type PropsUnionB = {',
1139+
' a?: void,',
1140+
' b: string,',
1141+
'};',
1142+
'type Props = {',
1143+
' name: string,',
1144+
'} & (PropsUnionA | PropsUnionB);',
1145+
'class Hello extends React.Component {',
1146+
' props: Props;',
1147+
' render() {',
1148+
' const {name} = this.props;',
1149+
' return name;',
1150+
' }',
1151+
'}'
1152+
].join('\n'),
1153+
parser: 'babel-eslint'
11321154
}, {
11331155
code: [
11341156
'Card.propTypes = {',

0 commit comments

Comments
 (0)