@@ -5392,16 +5392,7 @@ namespace ts {
53925392 }
53935393
53945394 function getBaseTypeNodeOfClass(type: InterfaceType): ExpressionWithTypeArguments | undefined {
5395- const decl = <ClassLikeDeclaration>type.symbol.valueDeclaration;
5396- if (isInJavaScriptFile(decl)) {
5397- // Prefer an @augments tag because it may have type parameters.
5398- const tag = getJSDocAugmentsTag(decl);
5399- if (tag) {
5400- return tag.class;
5401- }
5402- }
5403-
5404- return getClassExtendsHeritageClauseElement(decl);
5395+ return getEffectiveBaseTypeNode(type.symbol.valueDeclaration as ClassLikeDeclaration);
54055396 }
54065397
54075398 function getConstructorsForTypeArguments(type: Type, typeArgumentNodes: ReadonlyArray<TypeNode> | undefined, location: Node): Signature[] {
@@ -5428,7 +5419,7 @@ namespace ts {
54285419 function getBaseConstructorTypeOfClass(type: InterfaceType): Type {
54295420 if (!type.resolvedBaseConstructorType) {
54305421 const decl = <ClassLikeDeclaration>type.symbol.valueDeclaration;
5431- const extended = getClassExtendsHeritageClauseElement (decl);
5422+ const extended = getEffectiveBaseTypeNode (decl);
54325423 const baseTypeNode = getBaseTypeNodeOfClass(type);
54335424 if (!baseTypeNode) {
54345425 return type.resolvedBaseConstructorType = undefinedType;
@@ -14764,7 +14755,7 @@ namespace ts {
1476414755
1476514756 function checkThisBeforeSuper(node: Node, container: Node, diagnosticMessage: DiagnosticMessage) {
1476614757 const containingClassDecl = <ClassDeclaration>container.parent;
14767- const baseTypeNode = getClassExtendsHeritageClauseElement (containingClassDecl);
14758+ const baseTypeNode = getEffectiveBaseTypeNode (containingClassDecl);
1476814759
1476914760 // If a containing class does not have extends clause or the class extends null
1477014761 // skip checking whether super statement is called before "this" accessing.
@@ -15040,7 +15031,7 @@ namespace ts {
1504015031
1504115032 // at this point the only legal case for parent is ClassLikeDeclaration
1504215033 const classLikeDeclaration = <ClassLikeDeclaration>container.parent;
15043- if (!getClassExtendsHeritageClauseElement (classLikeDeclaration)) {
15034+ if (!getEffectiveBaseTypeNode (classLikeDeclaration)) {
1504415035 error(node, Diagnostics.super_can_only_be_referenced_in_a_derived_class);
1504515036 return errorType;
1504615037 }
@@ -18678,7 +18669,7 @@ namespace ts {
1867818669 if (superType !== errorType) {
1867918670 // In super call, the candidate signatures are the matching arity signatures of the base constructor function instantiated
1868018671 // with the type arguments specified in the extends clause.
18681- const baseTypeNode = getClassExtendsHeritageClauseElement (getContainingClass(node)!);
18672+ const baseTypeNode = getEffectiveBaseTypeNode (getContainingClass(node)!);
1868218673 if (baseTypeNode) {
1868318674 const baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments, baseTypeNode);
1868418675 return resolveCall(node, baseConstructors, candidatesOutArray);
@@ -21474,7 +21465,7 @@ namespace ts {
2147421465 // Constructors of classes with no extends clause may not contain super calls, whereas
2147521466 // constructors of derived classes must contain at least one super call somewhere in their function body.
2147621467 const containingClassDecl = <ClassDeclaration>node.parent;
21477- if (getClassExtendsHeritageClauseElement (containingClassDecl)) {
21468+ if (getEffectiveBaseTypeNode (containingClassDecl)) {
2147821469 captureLexicalThis(node.parent, containingClassDecl);
2147921470 const classExtendsNull = classDeclarationExtendsNull(containingClassDecl);
2148021471 const superCall = getSuperCallInConstructor(node);
@@ -22651,7 +22642,7 @@ namespace ts {
2265122642 }
2265222643
2265322644 const name = getIdentifierFromEntityNameExpression(node.class.expression);
22654- const extend = getClassExtendsHeritageClauseElement (classLike);
22645+ const extend = getClassExtendsHeritageElement (classLike);
2265522646 if (extend) {
2265622647 const className = getIdentifierFromEntityNameExpression(extend.expression);
2265722648 if (className && name.escapedText !== className.escapedText) {
@@ -24426,7 +24417,7 @@ namespace ts {
2442624417 checkClassForStaticPropertyNameConflicts(node);
2442724418 }
2442824419
24429- const baseTypeNode = getClassExtendsHeritageClauseElement (node);
24420+ const baseTypeNode = getEffectiveBaseTypeNode (node);
2443024421 if (baseTypeNode) {
2443124422 if (languageVersion < ScriptTarget.ES2015) {
2443224423 checkExternalEmitHelpers(baseTypeNode.parent, ExternalEmitHelpers.Extends);
@@ -24439,6 +24430,10 @@ namespace ts {
2443924430 const staticBaseType = getApparentType(baseConstructorType);
2444024431 checkBaseTypeAccessibility(staticBaseType, baseTypeNode);
2444124432 checkSourceElement(baseTypeNode.expression);
24433+ const extendsNode = getClassExtendsHeritageElement(node);
24434+ if (extendsNode && extendsNode !== baseTypeNode) {
24435+ checkExpression(extendsNode.expression);
24436+ }
2444224437 if (some(baseTypeNode.typeArguments)) {
2444324438 forEach(baseTypeNode.typeArguments, checkSourceElement);
2444424439 for (const constructor of getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode)) {
0 commit comments