TS: Fix crash in case of missing type roots

This commit is contained in:
Asger F
2019-11-16 10:25:03 +00:00
parent 4a885cbf92
commit dd50d29827
10 changed files with 28 additions and 1 deletions

View File

@@ -272,7 +272,9 @@ function handleOpenProjectCommand(command: OpenProjectCommand) {
});
for (let typeRoot of typeRoots || []) {
traverseTypeRoot(typeRoot, "");
if (fs.existsSync(typeRoot) && fs.statSync(typeRoot).isDirectory()) {
traverseTypeRoot(typeRoot, "");
}
}
for (let sourceFile of program.getSourceFiles()) {

View File

@@ -0,0 +1 @@
| tst.ts:0:0:0:0 | tst.ts |

View File

@@ -0,0 +1,4 @@
import javascript
from File file
select file

View File

@@ -0,0 +1,6 @@
{
"include": ["."],
"compilerOptions": {
"typeRoots": ["does-not-exist"]
}
}

View File

@@ -0,0 +1,2 @@
| tst.ts:0:0:0:0 | tst.ts |
| typeroot.d.ts:0:0:0:0 | typeroot.d.ts |

View File

@@ -0,0 +1,4 @@
import javascript
from File file
select file

View File

@@ -0,0 +1,6 @@
{
"include": ["."],
"compilerOptions": {
"typeRoots": ["typeroot.d.ts"]
}
}