diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 0be74856b1d..4d843618281 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2439,7 +2439,7 @@ namespace ts { [option: string]: string[] | boolean; } - export interface DiscoverTypingsSettings { + export interface DiscoverTypingsInfo { fileNames: string[]; // The file names that belong to the same project. cachePath: string; // The path to the typings cache projectRootPath: string; // The path to the project root directory diff --git a/src/services/jsTyping.ts b/src/services/jsTyping.ts index 01cc3eed3b1..22265cc1016 100644 --- a/src/services/jsTyping.ts +++ b/src/services/jsTyping.ts @@ -60,8 +60,12 @@ namespace ts.JsTyping { if (!safeList) { const result = readConfigFile(safeListPath, (path: string) => host.readFile(path)); - if (result.config) { safeList = result.config; } - else { safeList = {}; }; + if (result.config) { + safeList = result.config; + } + else { + safeList = {}; + }; } const filesToWatch: string[] = []; @@ -188,9 +192,13 @@ namespace ts.JsTyping { const fileNames = host.readDirectory(nodeModulesPath, "*.json", /*exclude*/ undefined, /*depth*/ 2); for (const fileName of fileNames) { const normalizedFileName = normalizePath(fileName); - if (getBaseFileName(normalizedFileName) !== "package.json") { continue; } + if (getBaseFileName(normalizedFileName) !== "package.json") { + continue; + } const result = readConfigFile(normalizedFileName, (path: string) => host.readFile(path)); - if (!result.config) { continue; } + if (!result.config) { + continue; + } const packageJson: PackageJson = result.config; // npm 3's package.json contains a "_requiredBy" field @@ -203,7 +211,9 @@ namespace ts.JsTyping { // If the package has its own d.ts typings, those will take precedence. Otherwise the package name will be used // to download d.ts files from DefinitelyTyped - if (!packageJson.name) { continue; } + if (!packageJson.name) { + continue; + } if (packageJson.typings) { const absolutePath = getNormalizedAbsolutePath(packageJson.typings, getDirectoryPath(normalizedFileName)); inferredTypings[packageJson.name] = absolutePath; diff --git a/src/services/shims.ts b/src/services/shims.ts index 684c206b994..25d0480de3e 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -990,16 +990,16 @@ namespace ts { public discoverTypings(discoverTypingsJson: string): string { const getCanonicalFileName = createGetCanonicalFileName(/*useCaseSensitivefileNames:*/ false); return this.forwardJSONCall("discoverTypings()", () => { - const settings = JSON.parse(discoverTypingsJson); + const info = JSON.parse(discoverTypingsJson); return ts.JsTyping.discoverTypings( this.host, - settings.fileNames, - toPath(settings.cachePath, settings.cachePath, getCanonicalFileName), - toPath(settings.projectRootPath, settings.projectRootPath, getCanonicalFileName), - toPath(settings.safeListPath, settings.safeListPath, getCanonicalFileName), - settings.packageNameToTypingLocation, - settings.typingOptions, - settings.compilerOptions); + info.fileNames, + toPath(info.cachePath, info.cachePath, getCanonicalFileName), + toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), + toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), + info.packageNameToTypingLocation, + info.typingOptions, + info.compilerOptions); }); } }