Merge pull request #11764 from Microsoft/vladima/11744

watch configuration files if they exist even if they cannot be parsed
This commit is contained in:
Vladimir Matveev
2016-10-20 21:15:47 -07:00
parent 46f7a0f4a4
commit a477d1f7bb
3 changed files with 63 additions and 16 deletions

View File

@@ -135,10 +135,12 @@ namespace ts.JsTyping {
* Get the typing info from common package manager json files like package.json or bower.json
*/
function getTypingNamesFromJson(jsonPath: string, filesToWatch: string[]) {
if (host.fileExists(jsonPath)) {
filesToWatch.push(jsonPath);
}
const result = readConfigFile(jsonPath, (path: string) => host.readFile(path));
if (result.config) {
const jsonConfig: PackageJson = result.config;
filesToWatch.push(jsonPath);
if (jsonConfig.dependencies) {
mergeTypings(getOwnKeys(jsonConfig.dependencies));
}