Skip to content

Commit 776f390

Browse files
committed
PR feedback
1 parent e342c95 commit 776f390

File tree

4 files changed

+334
-339
lines changed

4 files changed

+334
-339
lines changed

src/compiler/checker.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5368,22 +5368,17 @@ module ts {
53685368
}
53695369
}
53705370
}
5371-
// Target type is type of constructor signiture
5371+
// Target type is type of construct signature
53725372
let constructSignatures: Signature[];
53735373
if (rightType.flags & TypeFlags.Interface) {
5374-
constructSignatures = (<InterfaceTypeWithDeclaredMembers>rightType).declaredConstructSignatures;
5374+
constructSignatures = resolveDeclaredMembers(<InterfaceType>rightType).declaredConstructSignatures;
53755375
}
53765376
else if (rightType.flags & TypeFlags.Anonymous) {
5377-
constructSignatures = (<ResolvedType>rightType).constructSignatures;
5377+
constructSignatures = getSignaturesOfType(rightType, SignatureKind.Construct);
53785378
}
53795379

5380-
if (constructSignatures) {
5381-
let instanceType = getUnionType(map(constructSignatures, constructSignature => {
5382-
if (constructSignature.typeParameters && constructSignature.typeParameters.length !== 0) {
5383-
constructSignature = instantiateSignature(constructSignature, createTypeMapper(constructSignature.typeParameters, map(constructSignature.typeParameters, _ => anyType)), true)
5384-
}
5385-
return constructSignature.resolvedReturnType;
5386-
}));
5380+
if (constructSignatures && constructSignatures.length !== 0) {
5381+
let instanceType = getUnionType(map(constructSignatures, signature => getReturnTypeOfSignature(getErasedSignature(signature))));
53875382
// Pickup type from union types
53885383
if (type.flags & TypeFlags.Union) {
53895384
return getUnionTypeOfSubtypeConstituents(<UnionType>type, instanceType);

0 commit comments

Comments
 (0)