Simplify check for constructors

This commit is contained in:
Nathan Shively-Sanders
2015-12-04 09:00:04 -08:00
parent ae559a7ccf
commit b8af5248b5
-7
View File
@@ -2938,10 +2938,6 @@ namespace ts {
return type.resolvedBaseConstructorType;
}
function hasClassOrInterfaceBaseType(type: InterfaceType): boolean {
return !!forEach(getBaseTypes(type), t => !!(t.symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)));
}
function getBaseTypes(type: InterfaceType): ObjectType[] {
const isClass = type.symbol.flags & SymbolFlags.Class;
const isInterface = type.symbol.flags & SymbolFlags.Interface;
@@ -3375,9 +3371,6 @@ namespace ts {
}
function getDefaultConstructSignatures(classType: InterfaceType): Signature[] {
if (!hasClassOrInterfaceBaseType(classType)) {
return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false)];
}
const baseConstructorType = getBaseConstructorTypeOfClass(classType);
const baseSignatures = getSignaturesOfType(baseConstructorType, SignatureKind.Construct);
if(baseSignatures.length === 0) {