Minor clean up to make it more readable.

This commit is contained in:
Paul van Brenk
2015-04-22 18:00:09 -07:00
parent 5c44a0ff3e
commit f8424d0b0c
3 changed files with 26 additions and 19 deletions

View File

@@ -284,12 +284,13 @@ module ts {
* Read tsconfig.json file
* @param fileName The path to the config file
*/
export function readConfigFile(fileName: string): any {
export function readConfigFile(fileName: string): { config?: any; error?: Diagnostic } {
try {
var text = sys.readFile(fileName);
return /\S/.test(text) ? JSON.parse(text) : {};
return { config: /\S/.test(text) ? JSON.parse(text) : {} };
}
catch (e) {
return { error: createCompilerDiagnostic(Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) };
}
}