fix super call from class that has no basetype but with same symbol interface (#19068)

This commit is contained in:
kingwl
2017-10-16 10:39:55 +08:00
parent d4c0377395
commit 30c51ed324
6 changed files with 71 additions and 3 deletions

View File

@@ -13043,12 +13043,14 @@ namespace ts {
// at this point the only legal case for parent is ClassLikeDeclaration
const classLikeDeclaration = <ClassLikeDeclaration>container.parent;
if (!getClassExtendsHeritageClauseElement(classLikeDeclaration)) {
error(node, Diagnostics.super_can_only_be_referenced_in_a_derived_class);
return unknownType;
}
const classType = <InterfaceType>getDeclaredTypeOfSymbol(getSymbolOfNode(classLikeDeclaration));
const baseClassType = classType && getBaseTypes(classType)[0];
if (!baseClassType) {
if (!getClassExtendsHeritageClauseElement(classLikeDeclaration)) {
error(node, Diagnostics.super_can_only_be_referenced_in_a_derived_class);
}
return unknownType;
}