File tree 4 files changed +92
-70
lines changed
integrations/script-setup-with-typescript-eslint/no-undef/valid
4 files changed +92
-70
lines changed Original file line number Diff line number Diff line change @@ -321,13 +321,10 @@ function analyzeScriptSetupVariables(
321
321
)
322
322
323
323
const genericDefineNames = new Set < string > ( )
324
- const scriptElement = df . children . find ( isScriptElement )
325
- if (
326
- scriptElement &&
327
- isScriptSetupElement ( scriptElement ) &&
328
- findGenericDirective ( scriptElement )
329
- ) {
330
- for ( const variable of scriptElement . variables ) {
324
+ const scriptElements = df . children . filter ( isScriptElement )
325
+ const scriptSetupElement = scriptElements . find ( isScriptSetupElement )
326
+ if ( scriptSetupElement && findGenericDirective ( scriptSetupElement ) ) {
327
+ for ( const variable of scriptSetupElement . variables ) {
331
328
if ( variable . kind === "generic" ) {
332
329
genericDefineNames . add ( variable . id . name )
333
330
}
Original file line number Diff line number Diff line change 907
907
"init" : null
908
908
}
909
909
]
910
+ },
911
+ {
912
+ "name" : " T" ,
913
+ "identifiers" : [],
914
+ "defs" : [],
915
+ "references" : [
916
+ {
917
+ "identifier" : {
918
+ "type" : " Identifier" ,
919
+ "name" : " T" ,
920
+ "loc" : {
921
+ "start" : {
922
+ "line" : 5 ,
923
+ "column" : 27
924
+ },
925
+ "end" : {
926
+ "line" : 5 ,
927
+ "column" : 28
928
+ }
929
+ }
930
+ },
931
+ "from" : " module" ,
932
+ "init" : null
933
+ }
934
+ ]
910
935
}
911
936
],
912
937
"references" : [],
1296
1321
}
1297
1322
},
1298
1323
"from" : " module" ,
1299
- "resolved" : null ,
1300
1324
"init" : null
1301
1325
},
1302
1326
{
1451
1475
}
1452
1476
},
1453
1477
"from" : " module" ,
1454
- "resolved" : null ,
1455
1478
"init" : null
1456
1479
},
1457
1480
{
1477
1500
}
1478
1501
],
1479
1502
"through" : [
1480
- {
1481
- "identifier" : {
1482
- "type" : " Identifier" ,
1483
- "name" : " T" ,
1484
- "loc" : {
1485
- "start" : {
1486
- "line" : 5 ,
1487
- "column" : 27
1488
- },
1489
- "end" : {
1490
- "line" : 5 ,
1491
- "column" : 28
1492
- }
1493
- }
1494
- },
1495
- "from" : " module" ,
1496
- "resolved" : null ,
1497
- "init" : null
1498
- },
1499
1503
{
1500
1504
"identifier" : {
1501
1505
"type" : " Identifier" ,
Original file line number Diff line number Diff line change 907
907
"init" : null
908
908
}
909
909
]
910
+ },
911
+ {
912
+ "name" : " T" ,
913
+ "identifiers" : [],
914
+ "defs" : [],
915
+ "references" : [
916
+ {
917
+ "identifier" : {
918
+ "type" : " Identifier" ,
919
+ "name" : " T" ,
920
+ "loc" : {
921
+ "start" : {
922
+ "line" : 5 ,
923
+ "column" : 27
924
+ },
925
+ "end" : {
926
+ "line" : 5 ,
927
+ "column" : 28
928
+ }
929
+ }
930
+ },
931
+ "from" : " module" ,
932
+ "init" : null
933
+ }
934
+ ]
935
+ },
936
+ {
937
+ "name" : " U" ,
938
+ "identifiers" : [],
939
+ "defs" : [],
940
+ "references" : [
941
+ {
942
+ "identifier" : {
943
+ "type" : " Identifier" ,
944
+ "name" : " U" ,
945
+ "loc" : {
946
+ "start" : {
947
+ "line" : 5 ,
948
+ "column" : 35
949
+ },
950
+ "end" : {
951
+ "line" : 5 ,
952
+ "column" : 36
953
+ }
954
+ }
955
+ },
956
+ "from" : " module" ,
957
+ "init" : null
958
+ }
959
+ ]
910
960
}
911
961
],
912
962
"references" : [],
1296
1346
}
1297
1347
},
1298
1348
"from" : " module" ,
1299
- "resolved" : null ,
1300
1349
"init" : null
1301
1350
},
1302
1351
{
1315
1364
}
1316
1365
},
1317
1366
"from" : " module" ,
1318
- "resolved" : null ,
1319
1367
"init" : null
1320
1368
},
1321
1369
{
1470
1518
}
1471
1519
},
1472
1520
"from" : " module" ,
1473
- "resolved" : null ,
1474
1521
"init" : null
1475
1522
},
1476
1523
{
1489
1536
}
1490
1537
},
1491
1538
"from" : " module" ,
1492
- "resolved" : null ,
1493
1539
"init" : null
1494
1540
},
1495
1541
{
1515
1561
}
1516
1562
],
1517
1563
"through" : [
1518
- {
1519
- "identifier" : {
1520
- "type" : " Identifier" ,
1521
- "name" : " T" ,
1522
- "loc" : {
1523
- "start" : {
1524
- "line" : 5 ,
1525
- "column" : 27
1526
- },
1527
- "end" : {
1528
- "line" : 5 ,
1529
- "column" : 28
1530
- }
1531
- }
1532
- },
1533
- "from" : " module" ,
1534
- "resolved" : null ,
1535
- "init" : null
1536
- },
1537
- {
1538
- "identifier" : {
1539
- "type" : " Identifier" ,
1540
- "name" : " U" ,
1541
- "loc" : {
1542
- "start" : {
1543
- "line" : 5 ,
1544
- "column" : 35
1545
- },
1546
- "end" : {
1547
- "line" : 5 ,
1548
- "column" : 36
1549
- }
1550
- }
1551
- },
1552
- "from" : " module" ,
1553
- "resolved" : null ,
1554
- "init" : null
1555
- },
1556
1564
{
1557
1565
"identifier" : {
1558
1566
"type" : " Identifier" ,
Original file line number Diff line number Diff line change
1
+ <script lang="ts">
2
+ export default {}
3
+ </script >
4
+ <script setup lang="ts" generic =" T extends Foo | Bar " >
5
+ type Foo = number | string
6
+ type Bar = number [] | string []
7
+ interface Props {
8
+ msg? : T
9
+ }
10
+ defineProps <Props >(), {
11
+ msg: ' hello' ,
12
+ }
13
+ </script >
You can’t perform that action at this time.
0 commit comments