Allow multiple class base types; intersect them, as with interfaces (#23123)

This commit is contained in:
Wesley Wigham
2018-04-03 16:08:52 -07:00
committed by GitHub
parent a4593fd6db
commit 78ba32a110
6 changed files with 133 additions and 6 deletions

View File

@@ -16509,26 +16509,25 @@ namespace ts {
if (!(prop.parent.flags & SymbolFlags.Class)) {
return false;
}
let classType = getTypeOfSymbol(prop.parent) as InterfaceType;
let classType = getTypeOfSymbol(prop.parent);
while (true) {
classType = getSuperClass(classType);
classType = classType.symbol && getSuperClass(classType as InterfaceType);
if (!classType) {
return false;
}
const superProperty = getPropertyOfObjectType(classType, prop.escapedName);
const superProperty = getPropertyOfType(classType, prop.escapedName);
if (superProperty && superProperty.valueDeclaration) {
return true;
}
}
}
function getSuperClass(classType: InterfaceType): InterfaceType | undefined {
function getSuperClass(classType: InterfaceType): Type | undefined {
const x = getBaseTypes(classType);
if (x.length === 0) {
return undefined;
}
Debug.assert(x.length === 1);
return x[0] as InterfaceType;
return getIntersectionType(x);
}
function reportNonexistentProperty(propNode: Identifier, containingType: Type) {