File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -7349,13 +7349,24 @@ namespace ts {
7349
7349
return result;
7350
7350
}
7351
7351
7352
+ function isUnaryTupleTypeNode(node: TypeNode) {
7353
+ return node.kind === SyntaxKind.TupleType && (<TupleTypeNode>node).elementTypes.length === 1;
7354
+ }
7355
+
7356
+ function getImpliedConstraint(typeVariable: TypeVariable, checkNode: TypeNode, extendsNode: TypeNode): Type {
7357
+ return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(typeVariable, (<TupleTypeNode>checkNode).elementTypes[0], (<TupleTypeNode>extendsNode).elementTypes[0]) :
7358
+ getActualTypeVariable(getTypeFromTypeNode(checkNode)) === typeVariable ? getTypeFromTypeNode(extendsNode) :
7359
+ undefined;
7360
+ }
7361
+
7352
7362
function getConstrainedTypeVariable(typeVariable: TypeVariable, node: Node) {
7353
7363
let constraints: Type[];
7354
7364
while (isPartOfTypeNode(node)) {
7355
7365
const parent = node.parent;
7356
7366
if (parent.kind === SyntaxKind.ConditionalType && node === (<ConditionalTypeNode>parent).trueType) {
7357
- if (getActualTypeVariable(getTypeFromTypeNode((<ConditionalTypeNode>parent).checkType)) === typeVariable) {
7358
- constraints = append(constraints, getTypeFromTypeNode((<ConditionalTypeNode>parent).extendsType));
7367
+ const constraint = getImpliedConstraint(typeVariable, (<ConditionalTypeNode>parent).checkType, (<ConditionalTypeNode>parent).extendsType);
7368
+ if (constraint) {
7369
+ constraints = append(constraints, constraint);
7359
7370
}
7360
7371
}
7361
7372
node = parent;
You can’t perform that action at this time.
0 commit comments