@@ -1473,7 +1473,7 @@ foo().hello`
1473
1473
checkOutputErrorsIncremental ( host , emptyArray ) ;
1474
1474
} ) ;
1475
1475
1476
- it ( "updates errors when file transitively exported file changes" , ( ) => {
1476
+ describe ( "updates errors when file transitively exported file changes" , ( ) => {
1477
1477
const projectLocation = "/user/username/projects/myproject" ;
1478
1478
const config : File = {
1479
1479
path : `${ projectLocation } /tsconfig.json` ,
@@ -1521,19 +1521,48 @@ export class Data {
1521
1521
title: string;
1522
1522
}`
1523
1523
} ;
1524
- const filesWithoutConfig = [ libFile , app , lib2Public , lib2Data , lib1Public , lib1ToolsPublic , lib1ToolsInterface ] ;
1525
- const files = [ config , ...filesWithoutConfig ] ;
1526
- const host = createWatchedSystem ( files , { currentDirectory : projectLocation } ) ;
1527
- const watch = createWatchOfConfigFile ( config . path , host ) ;
1528
- checkProgramActualFiles ( watch ( ) , filesWithoutConfig . map ( f => f . path ) ) ;
1529
- checkOutputErrorsInitial ( host , emptyArray ) ;
1530
1524
1531
- host . writeFile ( lib1ToolsInterface . path , lib1ToolsInterface . content . replace ( "title" , "title2" ) ) ;
1532
- host . checkTimeoutQueueLengthAndRun ( 1 ) ;
1533
- checkProgramActualFiles ( watch ( ) , filesWithoutConfig . map ( f => f . path ) ) ;
1534
- checkOutputErrorsIncremental ( host , [
1535
- "lib2/data.ts(5,13): error TS2322: Type '{ title: string; }' is not assignable to type 'ITest'.\n Object literal may only specify known properties, but 'title' does not exist in type 'ITest'. Did you mean to write 'title2'?\n"
1536
- ] ) ;
1525
+ function verifyTransitiveExports ( filesWithoutConfig : ReadonlyArray < File > ) {
1526
+ const files = [ config , ...filesWithoutConfig ] ;
1527
+ const host = createWatchedSystem ( files , { currentDirectory : projectLocation } ) ;
1528
+ const watch = createWatchOfConfigFile ( config . path , host ) ;
1529
+ checkProgramActualFiles ( watch ( ) , filesWithoutConfig . map ( f => f . path ) ) ;
1530
+ checkOutputErrorsInitial ( host , emptyArray ) ;
1531
+
1532
+ host . writeFile ( lib1ToolsInterface . path , lib1ToolsInterface . content . replace ( "title" , "title2" ) ) ;
1533
+ host . checkTimeoutQueueLengthAndRun ( 1 ) ;
1534
+ checkProgramActualFiles ( watch ( ) , filesWithoutConfig . map ( f => f . path ) ) ;
1535
+ checkOutputErrorsIncremental ( host , [
1536
+ "lib2/data.ts(5,13): error TS2322: Type '{ title: string; }' is not assignable to type 'ITest'.\n Object literal may only specify known properties, but 'title' does not exist in type 'ITest'. Did you mean to write 'title2'?\n"
1537
+ ] ) ;
1538
+
1539
+ }
1540
+ it ( "when there are no circular import and exports" , ( ) => {
1541
+ verifyTransitiveExports ( [ libFile , app , lib2Public , lib2Data , lib1Public , lib1ToolsPublic , lib1ToolsInterface ] ) ;
1542
+ } ) ;
1543
+
1544
+ it ( "when there are circular import and exports" , ( ) => {
1545
+ const lib2Data : File = {
1546
+ path : `${ projectLocation } /lib2/data.ts` ,
1547
+ content : `import { ITest } from "lib1/public"; import { Data2 } from "./data2";
1548
+ export class Data {
1549
+ public dat?: Data2; public test() {
1550
+ const result: ITest = {
1551
+ title: "title"
1552
+ }
1553
+ return result;
1554
+ }
1555
+ }`
1556
+ } ;
1557
+ const lib2Data2 : File = {
1558
+ path : `${ projectLocation } /lib2/data2.ts` ,
1559
+ content : `import { Data } from "./data";
1560
+ export class Data2 {
1561
+ public dat?: Data;
1562
+ }`
1563
+ } ;
1564
+ verifyTransitiveExports ( [ libFile , app , lib2Public , lib2Data , lib2Data2 , lib1Public , lib1ToolsPublic , lib1ToolsInterface ] ) ;
1565
+ } ) ;
1537
1566
} ) ;
1538
1567
} ) ;
1539
1568
0 commit comments