Skip to content

Commit e58371e

Browse files
authored
Remove now unnessesary casts (#27954)
1 parent 7b9ae4d commit e58371e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/compiler/commandLineParser.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ namespace ts {
10131013
i++;
10141014
break;
10151015
case "list":
1016-
const result = parseListTypeOption(<CommandLineOptionOfListType>opt, args[i], errors);
1016+
const result = parseListTypeOption(opt, args[i], errors);
10171017
options[opt.name] = result || [];
10181018
if (result) {
10191019
i++;
@@ -1667,7 +1667,7 @@ namespace ts {
16671667
return undefined;
16681668
}
16691669
else if (optionDefinition.type === "list") {
1670-
return getCustomTypeMapOfCommandLineOption((<CommandLineOptionOfListType>optionDefinition).element);
1670+
return getCustomTypeMapOfCommandLineOption(optionDefinition.element);
16711671
}
16721672
else {
16731673
return (<CommandLineOptionOfCustomType>optionDefinition).type;
@@ -1731,7 +1731,7 @@ namespace ts {
17311731
case "object":
17321732
return {};
17331733
default:
1734-
return (option as CommandLineOptionOfCustomType).type.keys().next().value;
1734+
return option.type.keys().next().value;
17351735
}
17361736
}
17371737

@@ -2338,7 +2338,7 @@ namespace ts {
23382338
function normalizeOptionValue(option: CommandLineOption, basePath: string, value: any): CompilerOptionsValue {
23392339
if (isNullOrUndefined(value)) return undefined;
23402340
if (option.type === "list") {
2341-
const listOption = <CommandLineOptionOfListType>option;
2341+
const listOption = option;
23422342
if (listOption.element.isFilePath || !isString(listOption.element.type)) {
23432343
return <CompilerOptionsValue>filter(map(value, v => normalizeOptionValue(listOption.element, basePath, v)), v => !!v);
23442344
}
@@ -2745,7 +2745,7 @@ namespace ts {
27452745
case "boolean":
27462746
return typeof value === "boolean" ? value : "";
27472747
case "list":
2748-
const elementType = (option as CommandLineOptionOfListType).element;
2748+
const elementType = option.element;
27492749
return isArray(value) ? value.map(v => getOptionValueWithEmptyStrings(v, elementType)) : "";
27502750
default:
27512751
return forEachEntry(option.type, (optionEnumValue, optionStringValue) => {

src/harness/harness.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ namespace Harness {
11591159
}
11601160
// If not a primitive, the possible types are specified in what is effectively a map of options.
11611161
case "list":
1162-
return ts.parseListTypeOption(<ts.CommandLineOptionOfListType>option, value, errors);
1162+
return ts.parseListTypeOption(option, value, errors);
11631163
default:
11641164
return ts.parseCustomTypeOption(<ts.CommandLineOptionOfCustomType>option, value, errors);
11651165
}

src/services/getEditsForFileRename.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ namespace ts {
7272
case "compilerOptions":
7373
forEachProperty(property.initializer, (property, propertyName) => {
7474
const option = getOptionFromName(propertyName);
75-
if (option && (option.isFilePath || option.type === "list" && (option as CommandLineOptionOfListType).element.isFilePath)) {
75+
if (option && (option.isFilePath || option.type === "list" && option.element.isFilePath)) {
7676
updatePaths(property);
7777
}
7878
else if (propertyName === "paths") {

0 commit comments

Comments
 (0)