Always check extends clause of classes

Even if (1) @extends is provided and (2) we're not producing
diagnostics. That's because we need to know whether the extends clause
references an imported alias.
This commit is contained in:
Nathan Shively-Sanders
2019-04-05 16:37:27 -07:00
parent 0b3b4ea127
commit dabf2a6af2
6 changed files with 82 additions and 4 deletions

View File

@@ -27424,6 +27424,11 @@ namespace ts {
if (languageVersion < ScriptTarget.ES2015) {
checkExternalEmitHelpers(baseTypeNode.parent, ExternalEmitHelpers.Extends);
}
// check both @extends and extends if both are specified.
const extendsNode = getClassExtendsHeritageElement(node);
if (extendsNode && extendsNode !== baseTypeNode) {
checkExpression(extendsNode.expression);
}
const baseTypes = getBaseTypes(type);
if (baseTypes.length && produceDiagnostics) {
@@ -27432,10 +27437,6 @@ namespace ts {
const staticBaseType = getApparentType(baseConstructorType);
checkBaseTypeAccessibility(staticBaseType, baseTypeNode);
checkSourceElement(baseTypeNode.expression);
const extendsNode = getClassExtendsHeritageElement(node);
if (extendsNode && extendsNode !== baseTypeNode) {
checkExpression(extendsNode.expression);
}
if (some(baseTypeNode.typeArguments)) {
forEach(baseTypeNode.typeArguments, checkSourceElement);
for (const constructor of getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode)) {