Skip to content

Commit dc7863c

Browse files
authored
Merge pull request #2579 from asger-semmle/typescript-trace-resolution
Approved by max-schaefer
2 parents 29be461 + 2ca0e7d commit dc7863c

File tree

6 files changed

+22
-1
lines changed

6 files changed

+22
-1
lines changed

javascript/extractor/lib/typescript/src/common.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ export class Project {
1212
}
1313

1414
public load(): void {
15-
this.program = ts.createProgram(this.config.fileNames, this.config.options);
15+
let host = ts.createCompilerHost(this.config.options, true);
16+
host.trace = undefined; // Disable tracing which would otherwise go to standard out
17+
this.program = ts.createProgram(this.config.fileNames, this.config.options, host);
1618
this.typeTable.setProgram(this.program);
1719
}
1820

javascript/ql/test/library-tests/TypeScript/RegressionTests/TraceResolution/node_modules/@types/foo/index.d.ts

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
| node_modules/@types/foo/index.d.ts:1:17:1:19 | foo | () => any |
2+
| test.ts:1:10:1:12 | foo | () => any |
3+
| test.ts:1:10:1:12 | foo | () => any |
4+
| test.ts:1:21:1:25 | "foo" | any |
5+
| test.ts:3:1:3:3 | foo | () => any |
6+
| test.ts:3:1:3:5 | foo() | any |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import javascript
2+
3+
from Expr e select e, e.getType()
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { foo } from "foo";
2+
3+
foo();
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"include": ["."],
3+
"compilerOptions": {
4+
"traceResolution": true
5+
}
6+
}

0 commit comments

Comments
 (0)