@@ -3435,6 +3435,18 @@ ruleTester.run('prop-types', rule, {
3435
3435
` ,
3436
3436
features : [ 'ts' , 'no-babel' ] ,
3437
3437
} ,
3438
+ {
3439
+ code : `
3440
+ import React, { ForwardRefRenderFunction } from 'react'
3441
+
3442
+ type IfooProps = { e: string };
3443
+ const Foo: ForwardRefRenderFunction<HTMLDivElement, IfooProps> = (props, ref) => {
3444
+ const { e } = props;
3445
+ return <div ref={ref}>hello</div>;
3446
+ };
3447
+ ` ,
3448
+ features : [ 'ts' , 'no-babel' ] ,
3449
+ } ,
3438
3450
{
3439
3451
code : `
3440
3452
import React from 'react'
@@ -3459,6 +3471,39 @@ ruleTester.run('prop-types', rule, {
3459
3471
` ,
3460
3472
features : [ 'ts' , 'no-babel' ] ,
3461
3473
} ,
3474
+ {
3475
+ code : `
3476
+ import React from 'react'
3477
+ type IfooProps = { e: string };
3478
+ const Foo= React.forwardRef<HTMLDivElement, IfooProps>(function Foo(props, ref) {
3479
+ const { e } = props;
3480
+ return <div ref={ref}>hello</div>;
3481
+ });
3482
+ ` ,
3483
+ features : [ 'ts' , 'no-babel' ] ,
3484
+ } ,
3485
+ {
3486
+ code : `
3487
+ import React from 'react'
3488
+ interface IfooProps { e: string }
3489
+ const Foo= React.forwardRef<HTMLDivElement, IfooProps>(function Foo(props, ref) {
3490
+ const { e } = props;
3491
+ return <div ref={ref}>hello</div>;
3492
+ });
3493
+ ` ,
3494
+ features : [ 'ts' , 'no-babel' ] ,
3495
+ } ,
3496
+ {
3497
+ code : `
3498
+ import React, { forwardRef } from 'react'
3499
+ interface IfooProps { e: string }
3500
+ const Foo= forwardRef<HTMLDivElement, IfooProps>(function Foo(props, ref) {
3501
+ const { e } = props;
3502
+ return <div ref={ref}>hello</div>;
3503
+ });
3504
+ ` ,
3505
+ features : [ 'ts' , 'no-babel' ] ,
3506
+ } ,
3462
3507
{
3463
3508
code : `
3464
3509
import React, { forwardRef as X } from 'react'
@@ -7235,6 +7280,42 @@ ruleTester.run('prop-types', rule, {
7235
7280
} ,
7236
7281
] ,
7237
7282
features : [ 'ts' , 'no-babel' ] ,
7283
+ } ,
7284
+ {
7285
+ code : `
7286
+ import React from 'react'
7287
+
7288
+ type IfooProps = { e: string };
7289
+ const Foo= React.forwardRef<HTMLDivElement, IfooProps>(function Foo(props, ref) {
7290
+ const { l } = props;
7291
+ return <div ref={ref}>hello</div>;
7292
+ });
7293
+ ` ,
7294
+ errors : [
7295
+ {
7296
+ messageId : 'missingPropType' ,
7297
+ data : { name : 'l' } ,
7298
+ } ,
7299
+ ] ,
7300
+ features : [ 'ts' , 'no-babel' ] ,
7301
+ } ,
7302
+ {
7303
+ code : `
7304
+ import React, { forwardRef } from 'react'
7305
+
7306
+ type IfooProps = { e: string };
7307
+ const Foo= forwardRef<HTMLDivElement, IfooProps>(function Foo(props, ref) {
7308
+ const { l } = props;
7309
+ return <div ref={ref}>hello</div>;
7310
+ });
7311
+ ` ,
7312
+ errors : [
7313
+ {
7314
+ messageId : 'missingPropType' ,
7315
+ data : { name : 'l' } ,
7316
+ } ,
7317
+ ] ,
7318
+ features : [ 'ts' , 'no-babel' ] ,
7238
7319
}
7239
7320
) ) ,
7240
7321
} ) ;
0 commit comments