mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-08 22:29:37 -05:00
Instantiate constraint with default upon comparison (#31240)
This commit is contained in:
@@ -24441,7 +24441,7 @@ namespace ts {
|
||||
const constraintType = getConstraintOfTypeParameter(typeParameter);
|
||||
const defaultType = getDefaultFromTypeParameter(typeParameter);
|
||||
if (constraintType && defaultType) {
|
||||
checkTypeAssignableTo(defaultType, getTypeWithThisArgument(constraintType, defaultType), node.default, Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
|
||||
checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
|
||||
}
|
||||
if (produceDiagnostics) {
|
||||
checkTypeNameIsReserved(node.name, Diagnostics.Type_parameter_name_cannot_be_0);
|
||||
|
||||
Reference in New Issue
Block a user