mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
TS: Fix crash in case of missing type roots
This commit is contained in:
@@ -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()) {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
| tst.ts:0:0:0:0 | tst.ts |
|
||||
@@ -0,0 +1,4 @@
|
||||
import javascript
|
||||
|
||||
from File file
|
||||
select file
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"include": ["."],
|
||||
"compilerOptions": {
|
||||
"typeRoots": ["does-not-exist"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
let x = 5;
|
||||
@@ -0,0 +1,2 @@
|
||||
| tst.ts:0:0:0:0 | tst.ts |
|
||||
| typeroot.d.ts:0:0:0:0 | typeroot.d.ts |
|
||||
@@ -0,0 +1,4 @@
|
||||
import javascript
|
||||
|
||||
from File file
|
||||
select file
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"include": ["."],
|
||||
"compilerOptions": {
|
||||
"typeRoots": ["typeroot.d.ts"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
let x = 5;
|
||||
0
javascript/ql/test/library-tests/TypeScript/RegressionTests/TypeRootFile/typeroot.d.ts
vendored
Normal file
0
javascript/ql/test/library-tests/TypeScript/RegressionTests/TypeRootFile/typeroot.d.ts
vendored
Normal file
Reference in New Issue
Block a user