mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-12 01:48:33 -05:00
Remove now unnessesary casts (#27954)
This commit is contained in:
@@ -1013,7 +1013,7 @@ namespace ts {
|
||||
i++;
|
||||
break;
|
||||
case "list":
|
||||
const result = parseListTypeOption(<CommandLineOptionOfListType>opt, args[i], errors);
|
||||
const result = parseListTypeOption(opt, args[i], errors);
|
||||
options[opt.name] = result || [];
|
||||
if (result) {
|
||||
i++;
|
||||
@@ -1667,7 +1667,7 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
else if (optionDefinition.type === "list") {
|
||||
return getCustomTypeMapOfCommandLineOption((<CommandLineOptionOfListType>optionDefinition).element);
|
||||
return getCustomTypeMapOfCommandLineOption(optionDefinition.element);
|
||||
}
|
||||
else {
|
||||
return (<CommandLineOptionOfCustomType>optionDefinition).type;
|
||||
@@ -1731,7 +1731,7 @@ namespace ts {
|
||||
case "object":
|
||||
return {};
|
||||
default:
|
||||
return (option as CommandLineOptionOfCustomType).type.keys().next().value;
|
||||
return option.type.keys().next().value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2338,7 +2338,7 @@ namespace ts {
|
||||
function normalizeOptionValue(option: CommandLineOption, basePath: string, value: any): CompilerOptionsValue {
|
||||
if (isNullOrUndefined(value)) return undefined;
|
||||
if (option.type === "list") {
|
||||
const listOption = <CommandLineOptionOfListType>option;
|
||||
const listOption = option;
|
||||
if (listOption.element.isFilePath || !isString(listOption.element.type)) {
|
||||
return <CompilerOptionsValue>filter(map(value, v => normalizeOptionValue(listOption.element, basePath, v)), v => !!v);
|
||||
}
|
||||
@@ -2745,7 +2745,7 @@ namespace ts {
|
||||
case "boolean":
|
||||
return typeof value === "boolean" ? value : "";
|
||||
case "list":
|
||||
const elementType = (option as CommandLineOptionOfListType).element;
|
||||
const elementType = option.element;
|
||||
return isArray(value) ? value.map(v => getOptionValueWithEmptyStrings(v, elementType)) : "";
|
||||
default:
|
||||
return forEachEntry(option.type, (optionEnumValue, optionStringValue) => {
|
||||
|
||||
@@ -1159,7 +1159,7 @@ namespace Harness {
|
||||
}
|
||||
// If not a primitive, the possible types are specified in what is effectively a map of options.
|
||||
case "list":
|
||||
return ts.parseListTypeOption(<ts.CommandLineOptionOfListType>option, value, errors);
|
||||
return ts.parseListTypeOption(option, value, errors);
|
||||
default:
|
||||
return ts.parseCustomTypeOption(<ts.CommandLineOptionOfCustomType>option, value, errors);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace ts {
|
||||
case "compilerOptions":
|
||||
forEachProperty(property.initializer, (property, propertyName) => {
|
||||
const option = getOptionFromName(propertyName);
|
||||
if (option && (option.isFilePath || option.type === "list" && (option as CommandLineOptionOfListType).element.isFilePath)) {
|
||||
if (option && (option.isFilePath || option.type === "list" && option.element.isFilePath)) {
|
||||
updatePaths(property);
|
||||
}
|
||||
else if (propertyName === "paths") {
|
||||
|
||||
Reference in New Issue
Block a user