Skip to content

Commit e8772bc

Browse files
committed
- Adding new lines after { for single-line if statements
- Renaming DiscoverTypingsSettings to DiscoverTypingsInfo to match host
1 parent 4bbdf2a commit e8772bc

File tree

3 files changed

+24
-14
lines changed

3 files changed

+24
-14
lines changed

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2439,7 +2439,7 @@ namespace ts {
24392439
[option: string]: string[] | boolean;
24402440
}
24412441

2442-
export interface DiscoverTypingsSettings {
2442+
export interface DiscoverTypingsInfo {
24432443
fileNames: string[]; // The file names that belong to the same project.
24442444
cachePath: string; // The path to the typings cache
24452445
projectRootPath: string; // The path to the project root directory

src/services/jsTyping.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ namespace ts.JsTyping {
6060

6161
if (!safeList) {
6262
const result = readConfigFile(safeListPath, (path: string) => host.readFile(path));
63-
if (result.config) { safeList = result.config; }
64-
else { safeList = {}; };
63+
if (result.config) {
64+
safeList = result.config;
65+
}
66+
else {
67+
safeList = {};
68+
};
6569
}
6670

6771
const filesToWatch: string[] = [];
@@ -188,9 +192,13 @@ namespace ts.JsTyping {
188192
const fileNames = host.readDirectory(nodeModulesPath, "*.json", /*exclude*/ undefined, /*depth*/ 2);
189193
for (const fileName of fileNames) {
190194
const normalizedFileName = normalizePath(fileName);
191-
if (getBaseFileName(normalizedFileName) !== "package.json") { continue; }
195+
if (getBaseFileName(normalizedFileName) !== "package.json") {
196+
continue;
197+
}
192198
const result = readConfigFile(normalizedFileName, (path: string) => host.readFile(path));
193-
if (!result.config) { continue; }
199+
if (!result.config) {
200+
continue;
201+
}
194202
const packageJson: PackageJson = result.config;
195203

196204
// npm 3's package.json contains a "_requiredBy" field
@@ -203,7 +211,9 @@ namespace ts.JsTyping {
203211

204212
// If the package has its own d.ts typings, those will take precedence. Otherwise the package name will be used
205213
// to download d.ts files from DefinitelyTyped
206-
if (!packageJson.name) { continue; }
214+
if (!packageJson.name) {
215+
continue;
216+
}
207217
if (packageJson.typings) {
208218
const absolutePath = getNormalizedAbsolutePath(packageJson.typings, getDirectoryPath(normalizedFileName));
209219
inferredTypings[packageJson.name] = absolutePath;

src/services/shims.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -990,16 +990,16 @@ namespace ts {
990990
public discoverTypings(discoverTypingsJson: string): string {
991991
const getCanonicalFileName = createGetCanonicalFileName(/*useCaseSensitivefileNames:*/ false);
992992
return this.forwardJSONCall("discoverTypings()", () => {
993-
const settings = <DiscoverTypingsSettings>JSON.parse(discoverTypingsJson);
993+
const info = <DiscoverTypingsInfo>JSON.parse(discoverTypingsJson);
994994
return ts.JsTyping.discoverTypings(
995995
this.host,
996-
settings.fileNames,
997-
toPath(settings.cachePath, settings.cachePath, getCanonicalFileName),
998-
toPath(settings.projectRootPath, settings.projectRootPath, getCanonicalFileName),
999-
toPath(settings.safeListPath, settings.safeListPath, getCanonicalFileName),
1000-
settings.packageNameToTypingLocation,
1001-
settings.typingOptions,
1002-
settings.compilerOptions);
996+
info.fileNames,
997+
toPath(info.cachePath, info.cachePath, getCanonicalFileName),
998+
toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName),
999+
toPath(info.safeListPath, info.safeListPath, getCanonicalFileName),
1000+
info.packageNameToTypingLocation,
1001+
info.typingOptions,
1002+
info.compilerOptions);
10031003
});
10041004
}
10051005
}

0 commit comments

Comments
 (0)