Skip to content

Commit 47ccf77

Browse files
committed
Address PR feedback
1 parent 28a0f94 commit 47ccf77

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/compiler/checker.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2452,20 +2452,21 @@ module ts {
24522452
return result;
24532453
}
24542454

2455-
function getBaseTypes(type: InterfaceType): ObjectType[] {
2456-
if (!(<InterfaceTypeWithBaseTypes>type).baseTypes) {
2455+
function getBaseTypes(type: InterfaceType): ObjectType[]{
2456+
let typeWithBaseTypes = <InterfaceTypeWithBaseTypes>type;
2457+
if (!typeWithBaseTypes.baseTypes) {
24572458
if (type.symbol.flags & SymbolFlags.Class) {
2458-
resolveBaseTypesOfClass(<InterfaceTypeWithBaseTypes>type);
2459+
resolveBaseTypesOfClass(typeWithBaseTypes);
24592460
}
24602461
else if (type.symbol.flags & SymbolFlags.Interface) {
2461-
resolveBaseTypesOfInterface(<InterfaceTypeWithBaseTypes>type);
2462+
resolveBaseTypesOfInterface(typeWithBaseTypes);
24622463
}
24632464
else {
24642465
Debug.fail("type must be class or interface");
24652466
}
24662467
}
24672468

2468-
return (<InterfaceTypeWithBaseTypes>type).baseTypes;
2469+
return typeWithBaseTypes.baseTypes;
24692470
}
24702471

24712472
function resolveBaseTypesOfClass(type: InterfaceTypeWithBaseTypes): void {
@@ -2492,9 +2493,9 @@ module ts {
24922493

24932494
function resolveBaseTypesOfInterface(type: InterfaceTypeWithBaseTypes): void {
24942495
type.baseTypes = [];
2495-
forEach(type.symbol.declarations, declaration => {
2496+
for (let declaration of type.symbol.declarations) {
24962497
if (declaration.kind === SyntaxKind.InterfaceDeclaration && getInterfaceBaseTypeNodes(<InterfaceDeclaration>declaration)) {
2497-
forEach(getInterfaceBaseTypeNodes(<InterfaceDeclaration>declaration), node => {
2498+
for (let node of getInterfaceBaseTypeNodes(<InterfaceDeclaration>declaration)) {
24982499
let baseType = getTypeFromHeritageClauseElement(node);
24992500

25002501
if (baseType !== unknownType) {
@@ -2510,9 +2511,9 @@ module ts {
25102511
error(node, Diagnostics.An_interface_may_only_extend_a_class_or_another_interface);
25112512
}
25122513
}
2513-
});
2514+
}
25142515
}
2515-
});
2516+
}
25162517
}
25172518

25182519
function getDeclaredTypeOfClass(symbol: Symbol): InterfaceType {
@@ -2674,13 +2675,13 @@ module ts {
26742675
let baseTypes = getBaseTypes(type);
26752676
if (baseTypes.length) {
26762677
members = createSymbolTable(type.declaredProperties);
2677-
forEach(baseTypes, baseType => {
2678+
for (let baseType of baseTypes) {
26782679
addInheritedMembers(members, getPropertiesOfObjectType(baseType));
26792680
callSignatures = concatenate(callSignatures, getSignaturesOfType(baseType, SignatureKind.Call));
26802681
constructSignatures = concatenate(constructSignatures, getSignaturesOfType(baseType, SignatureKind.Construct));
26812682
stringIndexType = stringIndexType || getIndexTypeOfType(baseType, IndexKind.String);
26822683
numberIndexType = numberIndexType || getIndexTypeOfType(baseType, IndexKind.Number);
2683-
});
2684+
}
26842685
}
26852686
setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType);
26862687
}
@@ -10148,7 +10149,7 @@ module ts {
1014810149

1014910150
function checkInheritedPropertiesAreIdentical(type: InterfaceType, typeNode: Node): boolean {
1015010151
let baseTypes = getBaseTypes(type);
10151-
if (!baseTypes.length || baseTypes.length === 1) {
10152+
if (baseTypes.length < 2) {
1015210153
return true;
1015310154
}
1015410155

0 commit comments

Comments
 (0)