TS: Pass tsconfig options correctly

This commit is contained in:
Asger F
2019-11-15 14:23:58 +00:00
parent 23f8d27447
commit 0c41d6910f
5 changed files with 31 additions and 1 deletions

View File

@@ -253,7 +253,7 @@ function handleOpenProjectCommand(command: OpenProjectCommand) {
fileExists: (path: string) => fs.existsSync(path),
readFile: ts.sys.readFile,
};
let config = ts.parseJsonConfigFileContent(tsConfig, parseConfigHost, basePath);
let config = ts.parseJsonConfigFileContent(tsConfig.config, parseConfigHost, basePath);
let project = new Project(tsConfigFilename, config, state.typeTable);
project.load();

View File

@@ -0,0 +1,9 @@
exprType
| tst.ts:1:5:1:16 | stringOrNUll | string \| null |
| tst.ts:2:5:2:21 | stringOrUndefined | string \| undefined |
| tst.ts:3:5:3:27 | stringO ... defined | string \| null \| undefined |
| tst.ts:4:5:4:16 | stringOrVoid | string \| void |
| tst.ts:7:5:7:21 | stringOrNullAlias | string \| null |
| tst.ts:8:5:8:32 | stringO ... defined | string \| null \| undefined |
| tst.ts:10:5:10:23 | arrayOfStringOrNull | (string \| null)[] |
unaliasedType

View File

@@ -0,0 +1,5 @@
import javascript
query Type exprType(Expr e) { result = e.getType() }
query Type unaliasedType(TypeAliasReference ref) { result = ref.getAliasedType() }

View File

@@ -0,0 +1,6 @@
{
"include": ["."],
"compilerOptions": {
"strict": true
}
}

View File

@@ -0,0 +1,10 @@
let stringOrNUll: string | null;
let stringOrUndefined: string | undefined;
let stringOrNullOrUndefined: string | null | undefined;
let stringOrVoid: string | void;
type StringOrNullAlias = string | null;
let stringOrNullAlias: StringOrNullAlias;
let stringOrNullAliasOrUndefined: StringOrNullAlias | undefined;
let arrayOfStringOrNull: Array<string | null>;