Fixing few code review comments

This commit is contained in:
Sheetal Nandi 2015-10-05 12:27:06 -07:00
parent 0fe282e719
commit ce652dc7fb
4 changed files with 11 additions and 7 deletions

View file

@ -375,9 +375,14 @@ namespace ts {
}
}
/**
* Parses non quoted strings separated by comma e.g. "a,b" would result in string array ["a", "b"]
* @param s
* @param existingValue
*/
function parseMultiValueStringArray(s: string, existingValue: string[]) {
let value: string[] = existingValue || [];
let hasError: boolean;
let hasError = false;
let currentString = "";
if (s) {
for (let i = 0; i < s.length; i++) {
@ -480,8 +485,7 @@ namespace ts {
}
// Check if the value asked was string[] and value provided was not string[]
else if (expectedType !== "string[]" ||
typeof jsonValue !== "object" ||
typeof jsonValue.length !== "number" ||
!(jsonValue instanceof Array) ||
forEach(<string[]>jsonValue, individualValue => typeof individualValue !== "string")) {
// Not expectedType
errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType));

View file

@ -14,10 +14,10 @@ namespace ts {
export const version = "1.7.0";
export function findConfigFile(searchPath: string, moduleResolutionHost: ModuleResolutionHost): string {
export function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean): string {
let fileName = "tsconfig.json";
while (true) {
if (moduleResolutionHost.fileExists(fileName)) {
if (fileExists(fileName)) {
return fileName;
}
let parentPath = getDirectoryPath(searchPath);

View file

@ -188,7 +188,7 @@ namespace ts {
}
else if (commandLine.fileNames.length === 0 && isJSONSupported()) {
let searchPath = normalizePath(sys.getCurrentDirectory());
configFileName = findConfigFile(searchPath, sys);
configFileName = findConfigFile(searchPath, sys.fileExists);
}
if (commandLine.fileNames.length === 0 && !configFileName) {

View file

@ -195,7 +195,7 @@ class ProjectRunner extends RunnerBase {
assert(!inputFiles || inputFiles.length === 0, "cannot specify input files and project option together");
}
else if (!inputFiles || inputFiles.length === 0) {
configFileName = ts.findConfigFile("", { fileExists, readFile: getSourceFileText });
configFileName = ts.findConfigFile("", fileExists);
}
if (configFileName) {