Skip to content

Commit 368d0ed

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

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/compiler/commandLineParser.ts

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

1742+
/** @internal */
1743+
export interface TSConfig {
1744+
compilerOptions: CompilerOptions;
1745+
compileOnSave: boolean | undefined;
1746+
exclude?: ReadonlyArray<string>;
1747+
files: ReadonlyArray<string> | undefined;
1748+
include?: ReadonlyArray<string>;
1749+
references: ReadonlyArray<ProjectReference> | undefined;
1750+
}
1751+
17421752
/**
17431753
* Generate an uncommented, complete tsconfig for use with "--showConfig"
17441754
* @param configParseResult options to be generated into tsconfig.json
17451755
* @param configFileName name of the parsed config file - output paths will be generated relative to this
17461756
* @param host provides current directory and case sensitivity services
17471757
*/
17481758
/** @internal */
1749-
export function convertToTSConfig(configParseResult: ParsedCommandLine, configFileName: string, host: { getCurrentDirectory(): string, useCaseSensitiveFileNames: boolean }): object {
1759+
export function convertToTSConfig(configParseResult: ParsedCommandLine, configFileName: string, host: { getCurrentDirectory(): string, useCaseSensitiveFileNames: boolean }): TSConfig {
17501760
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames);
17511761
const files = map(
17521762
filter(
@@ -1774,13 +1784,13 @@ namespace ts {
17741784
build: undefined,
17751785
version: undefined,
17761786
},
1777-
references: map(configParseResult.projectReferences, r => ({ ...r, path: r.originalPath, originalPath: undefined })),
1787+
references: map(configParseResult.projectReferences, r => ({ ...r, path: r.originalPath ? r.originalPath : "", originalPath: undefined })),
17781788
files: length(files) ? files : undefined,
17791789
...(configParseResult.configFileSpecs ? {
17801790
include: filterSameAsDefaultInclude(configParseResult.configFileSpecs.validatedIncludeSpecs),
17811791
exclude: configParseResult.configFileSpecs.validatedExcludeSpecs
17821792
} : {}),
1783-
compilerOnSave: !!configParseResult.compileOnSave ? true : undefined
1793+
compileOnSave: !!configParseResult.compileOnSave ? true : undefined
17841794
};
17851795
return config;
17861796
}

0 commit comments

Comments
 (0)