Skip to content

Commit

Permalink
Check for type parameters on the original type when asking for the ty…
Browse files Browse the repository at this point in the history
…pe argument constraint.
  • Loading branch information
DanielRosenwasser committed Nov 1, 2021
1 parent e77514a commit 3c0d51b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34729,7 +34729,8 @@ namespace ts {
function getTypeArgumentConstraint(node: TypeNode): Type | undefined {
const typeReferenceNode = tryCast(node.parent, isTypeReferenceType);
if (!typeReferenceNode) return undefined;
const typeParameters = getTypeParametersForTypeReference(typeReferenceNode)!; // TODO: GH#18217
const typeParameters = getTypeParametersForTypeReference(typeReferenceNode);
if (!typeParameters) return undefined;
const constraint = getConstraintOfTypeParameter(typeParameters[typeReferenceNode.typeArguments!.indexOf(node)]);
return constraint && instantiateType(constraint, createTypeMapper(typeParameters, getEffectiveTypeArguments(typeReferenceNode, typeParameters)));
}
Expand Down

0 comments on commit 3c0d51b

Please sign in to comment.