mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Check for type parameters on the original type when asking for the type argument constraint.
This commit is contained in:
committed by
GitHub
parent
e77514a53b
commit
3c0d51b3ed
@@ -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)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user