File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -8430,15 +8430,19 @@ namespace ts {
8430
8430
return result;
8431
8431
}
8432
8432
8433
- function getTopConditionalType(node: Node): ConditionalTypeNode {
8434
- let result: ConditionalTypeNode;
8433
+ function isPossiblyReferencedInConditionalType(tp: TypeParameter, node: Node) {
8434
+ if (isTypeParameterPossiblyReferenced(tp, node)) {
8435
+ return true;
8436
+ }
8435
8437
while (node) {
8436
8438
if (node.kind === SyntaxKind.ConditionalType) {
8437
- result = <ConditionalTypeNode>node;
8439
+ if (isTypeParameterPossiblyReferenced(tp, (<ConditionalTypeNode>node).extendsType)) {
8440
+ return true;
8441
+ }
8438
8442
}
8439
8443
node = node.parent;
8440
8444
}
8441
- return result ;
8445
+ return false ;
8442
8446
}
8443
8447
8444
8448
function getTypeFromConditionalTypeNode(node: ConditionalTypeNode): Type {
@@ -8447,8 +8451,7 @@ namespace ts {
8447
8451
const checkType = getTypeFromTypeNode(node.checkType);
8448
8452
const aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node);
8449
8453
const allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
8450
- const topNode = getTopConditionalType(node);
8451
- const outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : filter(allOuterTypeParameters, tp => isTypeParameterPossiblyReferenced(tp, topNode));
8454
+ const outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : filter(allOuterTypeParameters, tp => isPossiblyReferencedInConditionalType(tp, node));
8452
8455
const root: ConditionalRoot = {
8453
8456
node,
8454
8457
checkType,
You can’t perform that action at this time.
0 commit comments