Merge pull request #15954 from Microsoft/typeArgs

Unconditionally compute type arguments of class base type
This commit is contained in:
Andy
2017-05-19 10:36:39 -07:00
committed by GitHub
6 changed files with 37 additions and 18 deletions

View File

@@ -4852,6 +4852,7 @@ namespace ts {
return;
}
const baseTypeNode = getBaseTypeNodeOfClass(type);
const typeArgs = typeArgumentsFromTypeReferenceNode(baseTypeNode);
let baseType: Type;
const originalBaseType = baseConstructorType && baseConstructorType.symbol ? getDeclaredTypeOfSymbol(baseConstructorType.symbol) : undefined;
if (baseConstructorType.symbol && baseConstructorType.symbol.flags & SymbolFlags.Class &&
@@ -4859,7 +4860,7 @@ namespace ts {
// When base constructor type is a class with no captured type arguments we know that the constructors all have the same type parameters as the
// class and all return the instance type of the class. There is no need for further checks and we can apply the
// type arguments in the same manner as a type reference to get the same error reporting experience.
baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol, typeArgumentsFromTypeReferenceNode(baseTypeNode));
baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol, typeArgs);
}
else if (baseConstructorType.flags & TypeFlags.Any) {
baseType = baseConstructorType;