Skip to content

Commit 816f729

Browse files
committed
Define interface for TSConfig. Change compilerOnSave to compileOnSave
1 parent dbabc12 commit 816f729

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

src/compiler/commandLineParser.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,14 +1739,23 @@ namespace ts {
17391739
return false;
17401740
}
17411741

1742+
export interface TSConfig {
1743+
compilerOptions: CompilerOptions;
1744+
compileOnSave: boolean | undefined;
1745+
references: ReadonlyArray<ProjectReference> | undefined;
1746+
exclude?: ReadonlyArray<string>;
1747+
include?: ReadonlyArray<string>;
1748+
files: ReadonlyArray<string> | undefined;
1749+
}
1750+
17421751
/**
17431752
* Generate an uncommented, complete tsconfig for use with "--showConfig"
17441753
* @param configParseResult options to be generated into tsconfig.json
17451754
* @param configFileName name of the parsed config file - output paths will be generated relative to this
17461755
* @param host provides current directory and case sensitivity services
17471756
*/
17481757
/** @internal */
1749-
export function convertToTSConfig(configParseResult: ParsedCommandLine, configFileName: string, host: { getCurrentDirectory(): string, useCaseSensitiveFileNames: boolean }): object {
1758+
export function convertToTSConfig(configParseResult: ParsedCommandLine, configFileName: string, host: { getCurrentDirectory(): string, useCaseSensitiveFileNames: boolean }): TSConfig {
17501759
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames);
17511760
const files = map(
17521761
filter(
@@ -1774,13 +1783,13 @@ namespace ts {
17741783
build: undefined,
17751784
version: undefined,
17761785
},
1777-
references: map(configParseResult.projectReferences, r => ({ ...r, path: r.originalPath, originalPath: undefined })),
1786+
references: map(configParseResult.projectReferences, r => ({ ...r, path: r.originalPath ? r.originalPath : "", originalPath: undefined })),
17781787
files: length(files) ? files : undefined,
17791788
...(configParseResult.configFileSpecs ? {
17801789
include: filterSameAsDefaultInclude(configParseResult.configFileSpecs.validatedIncludeSpecs),
17811790
exclude: configParseResult.configFileSpecs.validatedExcludeSpecs
17821791
} : {}),
1783-
compilerOnSave: !!configParseResult.compileOnSave ? true : undefined
1792+
compileOnSave: !!configParseResult.compileOnSave ? true : undefined
17841793
};
17851794
return config;
17861795
}

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3668,6 +3668,14 @@ declare namespace ts {
36683668
* Convert the json syntax tree into the json value
36693669
*/
36703670
function convertToObject(sourceFile: JsonSourceFile, errors: Push<Diagnostic>): any;
3671+
interface TSConfig {
3672+
compilerOptions: CompilerOptions;
3673+
compileOnSave: boolean | undefined;
3674+
references: ReadonlyArray<ProjectReference> | undefined;
3675+
exclude?: ReadonlyArray<string>;
3676+
include?: ReadonlyArray<string>;
3677+
files: ReadonlyArray<string> | undefined;
3678+
}
36713679
/**
36723680
* Parse the contents of a config file (tsconfig.json).
36733681
* @param json The contents of the config file to parse

tests/baselines/reference/api/typescript.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3668,6 +3668,14 @@ declare namespace ts {
36683668
* Convert the json syntax tree into the json value
36693669
*/
36703670
function convertToObject(sourceFile: JsonSourceFile, errors: Push<Diagnostic>): any;
3671+
interface TSConfig {
3672+
compilerOptions: CompilerOptions;
3673+
compileOnSave: boolean | undefined;
3674+
references: ReadonlyArray<ProjectReference> | undefined;
3675+
exclude?: ReadonlyArray<string>;
3676+
include?: ReadonlyArray<string>;
3677+
files: ReadonlyArray<string> | undefined;
3678+
}
36713679
/**
36723680
* Parse the contents of a config file (tsconfig.json).
36733681
* @param json The contents of the config file to parse

0 commit comments

Comments
 (0)