Skip to content

Commit 3c0d51b

Browse files
Check for type parameters on the original type when asking for the type argument constraint.
1 parent e77514a commit 3c0d51b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/compiler/checker.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -34729,7 +34729,8 @@ namespace ts {
3472934729
function getTypeArgumentConstraint(node: TypeNode): Type | undefined {
3473034730
const typeReferenceNode = tryCast(node.parent, isTypeReferenceType);
3473134731
if (!typeReferenceNode) return undefined;
34732-
const typeParameters = getTypeParametersForTypeReference(typeReferenceNode)!; // TODO: GH#18217
34732+
const typeParameters = getTypeParametersForTypeReference(typeReferenceNode);
34733+
if (!typeParameters) return undefined;
3473334734
const constraint = getConstraintOfTypeParameter(typeParameters[typeReferenceNode.typeArguments!.indexOf(node)]);
3473434735
return constraint && instantiateType(constraint, createTypeMapper(typeParameters, getEffectiveTypeArguments(typeReferenceNode, typeParameters)));
3473534736
}

0 commit comments

Comments
 (0)