Skip to content

Commit c37344b

Browse files
committed
Add regression tests for nullcheck on rootNode
use any since string isn't relevant rebase
1 parent 4a2ea55 commit c37344b

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/lib/rules/prop-types.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3361,6 +3361,20 @@ ruleTester.run('prop-types', rule, {
33613361
`,
33623362
features: ['ts', 'no-babel'],
33633363
},
3364+
{
3365+
code: `
3366+
import React from "react";
3367+
3368+
const returnTypeProp = (someProp: any) => ({ someProp });
3369+
3370+
const SomeComponent: React.FunctionComponent<
3371+
ReturnType<typeof returnTypeProp>
3372+
> = ({ someProp }) => {
3373+
return <div>{someProp}</div>;
3374+
};
3375+
`,
3376+
features: ['ts', 'no-babel'],
3377+
},
33643378
{
33653379
code: `
33663380
export const EuiSuperSelectControl: <T extends string>(
@@ -7840,6 +7854,26 @@ ruleTester.run('prop-types', rule, {
78407854
],
78417855
features: ['ts', 'no-babel'],
78427856
},
7857+
{
7858+
code: `
7859+
import React from "react";
7860+
7861+
const returnTypeProp = (someProp: any) => ({ someProp });
7862+
7863+
const SomeComponent: React.FunctionComponent<
7864+
ReturnType<typeof returnTypeProp>
7865+
> = ({ someIncorrectProp }) => {
7866+
return <div>{someProp}</div>;
7867+
};
7868+
`,
7869+
errors: [
7870+
{
7871+
messageId: 'missingPropType',
7872+
data: { name: 'someIncorrectProp' },
7873+
},
7874+
],
7875+
features: ['ts', 'no-babel'],
7876+
},
78437877
{
78447878
code: `
78457879
import React from 'react';

0 commit comments

Comments
 (0)