diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index c53e2fcc2ec..518d7a2a1f3 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -664,6 +664,22 @@ namespace ts { const compilerOptions: CompilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); const options = extend(existingOptions, compilerOptions); const typingOptions: TypingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + + // Contains the properties on the json we don't recognize, but the + // host might so we return them as a property bag. This allows the host to handle + // them, but doesn't have to deal with removing comments from the source json. + const other: any = {}; + + const knownProperties = ["compilerOptions", "typingOptions", "files", "exclude"]; + + for (const prop in json) { + if (knownProperties.indexOf(prop) >= 0) { + continue; + } + + other[prop] = json[prop]; + } + options.configFilePath = configFileName; const fileNames = getFileNames(errors); @@ -672,6 +688,7 @@ namespace ts { options, fileNames, typingOptions, + other, errors }; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index d0d411a710e..aede79fe237 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2592,6 +2592,7 @@ namespace ts { options: CompilerOptions; typingOptions?: TypingOptions; fileNames: string[]; + other?: any; errors: Diagnostic[]; } diff --git a/src/services/shims.ts b/src/services/shims.ts index b849407ebab..21f2454d7c3 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -997,6 +997,7 @@ namespace ts { options: {}, typingOptions: {}, files: [], + other: {}, errors: [realizeDiagnostic(result.error, "\r\n")] }; } @@ -1008,6 +1009,7 @@ namespace ts { options: configFile.options, typingOptions: configFile.typingOptions, files: configFile.fileNames, + other: configFile.other, errors: realizeDiagnostics(configFile.errors, "\r\n") }; });