Skip to content

Commit

Permalink
Add regression tests for nullcheck on rootNode
Browse files Browse the repository at this point in the history
use any since string isn't relevant rebase
  • Loading branch information
crnhrv committed May 31, 2024
1 parent 4a2ea55 commit c37344b
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/lib/rules/prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -3361,6 +3361,20 @@ ruleTester.run('prop-types', rule, {
`,
features: ['ts', 'no-babel'],
},
{
code: `
import React from "react";
const returnTypeProp = (someProp: any) => ({ someProp });
const SomeComponent: React.FunctionComponent<
ReturnType<typeof returnTypeProp>
> = ({ someProp }) => {
return <div>{someProp}</div>;
};
`,
features: ['ts', 'no-babel'],
},
{
code: `
export const EuiSuperSelectControl: <T extends string>(
Expand Down Expand Up @@ -7840,6 +7854,26 @@ ruleTester.run('prop-types', rule, {
],
features: ['ts', 'no-babel'],
},
{
code: `
import React from "react";
const returnTypeProp = (someProp: any) => ({ someProp });
const SomeComponent: React.FunctionComponent<
ReturnType<typeof returnTypeProp>
> = ({ someIncorrectProp }) => {
return <div>{someProp}</div>;
};
`,
errors: [
{
messageId: 'missingPropType',
data: { name: 'someIncorrectProp' },
},
],
features: ['ts', 'no-babel'],
},
{
code: `
import React from 'react';
Expand Down

0 comments on commit c37344b

Please sign in to comment.