Skip to content

Commit 1e806ce

Browse files
author
Kanchalai Tanglertsampan
committed
For React Component class, we fill in missing type parameter and instantiate the constructor signature with the new type arguments.
1 parent 975bc76 commit 1e806ce

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/compiler/checker.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13438,7 +13438,18 @@ namespace ts {
1343813438
}
1343913439
}
1344013440

13441-
return getUnionType(map(signatures, getReturnTypeOfSignature), /*subtypeReduction*/ true);
13441+
const instantiatedSignatures = [];
13442+
for (const signature of signatures) {
13443+
if (signature.typeParameters) {
13444+
const typeArguments = fillMissingTypeArguments(/*typeArguments*/ undefined, signature.typeParameters, /*minTypeArgumentCount*/ 0);
13445+
instantiatedSignatures.push(getSignatureInstantiation(signature, typeArguments));
13446+
}
13447+
else {
13448+
instantiatedSignatures.push(signature);
13449+
}
13450+
}
13451+
13452+
return getUnionType(map(instantiatedSignatures, getReturnTypeOfSignature), /*subtypeReduction*/ true);
1344213453
}
1344313454

1344413455
/**

0 commit comments

Comments
 (0)