Skip to content

Commit c16c7d5

Browse files
committed
Allow base constructor types to be intersections
1 parent a9af10b commit c16c7d5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/compiler/checker.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3810,7 +3810,7 @@ namespace ts {
38103810
}
38113811

38123812
function isConstructorType(type: Type): boolean {
3813-
return type.flags & TypeFlags.Object && getSignaturesOfType(type, SignatureKind.Construct).length > 0;
3813+
return isValidBaseType(type) && getSignaturesOfType(type, SignatureKind.Construct).length > 0;
38143814
}
38153815

38163816
function getBaseTypeNodeOfClass(type: InterfaceType): ExpressionWithTypeArguments {
@@ -3849,7 +3849,7 @@ namespace ts {
38493849
return unknownType;
38503850
}
38513851
const baseConstructorType = checkExpression(baseTypeNode.expression);
3852-
if (baseConstructorType.flags & TypeFlags.Object) {
3852+
if (baseConstructorType.flags & (TypeFlags.Object | TypeFlags.Intersection)) {
38533853
// Resolving the members of a class requires us to resolve the base class of that class.
38543854
// We force resolution here such that we catch circularities now.
38553855
resolveStructuredTypeMembers(<ObjectType>baseConstructorType);
@@ -3890,7 +3890,7 @@ namespace ts {
38903890
function resolveBaseTypesOfClass(type: InterfaceType): void {
38913891
type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray;
38923892
const baseConstructorType = <ObjectType>getBaseConstructorTypeOfClass(type);
3893-
if (!(baseConstructorType.flags & TypeFlags.Object)) {
3893+
if (!(baseConstructorType.flags & (TypeFlags.Object | TypeFlags.Intersection))) {
38943894
return;
38953895
}
38963896
const baseTypeNode = getBaseTypeNodeOfClass(type);
@@ -4591,9 +4591,9 @@ namespace ts {
45914591
constructSignatures = getDefaultConstructSignatures(classType);
45924592
}
45934593
const baseConstructorType = getBaseConstructorTypeOfClass(classType);
4594-
if (baseConstructorType.flags & TypeFlags.Object) {
4594+
if (baseConstructorType.flags & (TypeFlags.Object | TypeFlags.Intersection)) {
45954595
members = createSymbolTable(getNamedMembers(members));
4596-
addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType));
4596+
addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
45974597
}
45984598
}
45994599
const numberIndexInfo = symbol.flags & SymbolFlags.Enum ? enumNumberIndexInfo : undefined;

0 commit comments

Comments
 (0)