@@ -27344,12 +27344,10 @@ namespace ts {
27344
27344
}
27345
27345
27346
27346
if (isPartOfTypeNode(node)) {
27347
- let typeFromTypeNode = getTypeFromTypeNode(<TypeNode>node);
27347
+ const typeFromTypeNode = getTypeFromTypeNode(<TypeNode>node);
27348
27348
27349
27349
if (isExpressionWithTypeArgumentsInClassImplementsClause(node)) {
27350
- const containingClass = getContainingClass(node)!;
27351
- const classType = getTypeOfNode(containingClass) as InterfaceType;
27352
- typeFromTypeNode = getTypeWithThisArgument(typeFromTypeNode, classType.thisType);
27350
+ return getTypeWithThisArgument(typeFromTypeNode, getTypeOfClassContainingHeritageClause(node).thisType);
27353
27351
}
27354
27352
27355
27353
return typeFromTypeNode;
@@ -27362,8 +27360,7 @@ namespace ts {
27362
27360
if (isExpressionWithTypeArgumentsInClassExtendsClause(node)) {
27363
27361
// A SyntaxKind.ExpressionWithTypeArguments is considered a type node, except when it occurs in the
27364
27362
// extends clause of a class. We handle that case here.
27365
- const classNode = getContainingClass(node)!;
27366
- const classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classNode)) as InterfaceType;
27363
+ const classType = getTypeOfClassContainingHeritageClause(node);
27367
27364
const baseType = firstOrUndefined(getBaseTypes(classType));
27368
27365
return baseType ? getTypeWithThisArgument(baseType, classType.thisType) : errorType;
27369
27366
}
@@ -27405,6 +27402,10 @@ namespace ts {
27405
27402
return errorType;
27406
27403
}
27407
27404
27405
+ function getTypeOfClassContainingHeritageClause(node: ExpressionWithTypeArguments): InterfaceType {
27406
+ return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node.parent.parent));
27407
+ }
27408
+
27408
27409
// Gets the type of object literal or array literal of destructuring assignment.
27409
27410
// { a } from
27410
27411
// for ( { a } of elems) {
0 commit comments