Skip to content

Commit fb0ace7

Browse files
committed
refactor(tsfmt): refactor TSCONFIG_CACHE code style
1 parent 0e42c1b commit fb0ace7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/utils.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import * as ts from "typescript";
33
import * as fs from "fs";
44
import * as path from "path";
55

6-
declare type CONFIG_CACHE<T> = { [file: string]: T };
7-
const TSCONFIG_CACHE: CONFIG_CACHE<ts.ParsedCommandLine> = {};
6+
const TSCONFIG_CACHE: { [filePath: string]: ts.ParsedCommandLine; } = {};
87

98
export function createDefaultFormatCodeSettings(): ts.FormatCodeSettings {
109

@@ -52,7 +51,9 @@ export function readFilesFromTsconfig(configPath: string): string[] {
5251
}
5352

5453
export function readTsconfig(configPath: string): ts.ParsedCommandLine {
55-
if (TSCONFIG_CACHE[configPath]) return TSCONFIG_CACHE[configPath];
54+
if (TSCONFIG_CACHE[configPath]) {
55+
return TSCONFIG_CACHE[configPath];
56+
}
5657

5758
// for `extends` support. It supported from TypeScript 2.1.1.
5859
// `& { readFile(path: string): string; }` is backword compat for TypeScript compiler 2.0.3 support.

0 commit comments

Comments
 (0)