Skip to content

Commit 28450d5

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 d1a202d commit 28450d5

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
@@ -13397,7 +13397,18 @@ namespace ts {
1339713397
}
1339813398
}
1339913399

13400-
return getUnionType(map(signatures, getReturnTypeOfSignature), /*subtypeReduction*/ true);
13400+
const instantiatedSignatures = [];
13401+
for (const signature of signatures) {
13402+
if (signature.typeParameters) {
13403+
const typeArguments = fillMissingTypeArguments(/*typeArguments*/ undefined, signature.typeParameters, /*minTypeArgumentCount*/ 0);
13404+
instantiatedSignatures.push(getSignatureInstantiation(signature, typeArguments));
13405+
}
13406+
else {
13407+
instantiatedSignatures.push(signature);
13408+
}
13409+
}
13410+
13411+
return getUnionType(map(instantiatedSignatures, getReturnTypeOfSignature), /*subtypeReduction*/ true);
1340113412
}
1340213413

1340313414
/**

0 commit comments

Comments
 (0)