mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 01:49:57 -05:00
Properly implement type relationship for '[P in S]: X' and '[P in T]: Y'
This commit is contained in:
@@ -7047,11 +7047,12 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
if (isGenericMappedType(target)) {
|
||||
// A type [P in S]: X is related to a type [P in T]: X if T is related to S.
|
||||
if (isGenericMappedType(source) &&
|
||||
isRelatedTo(getConstraintTypeFromMappedType(<MappedType>target), getConstraintTypeFromMappedType(<MappedType>source), /*reportErrors*/ false) &&
|
||||
isTypeIdenticalTo(getTemplateTypeFromMappedType(<MappedType>source), getTemplateTypeFromMappedType(<MappedType>target))) {
|
||||
return Ternary.True;
|
||||
// A type [P in S]: X is related to a type [P in T]: Y if T is related to S and X is related to Y.
|
||||
if (isGenericMappedType(source)) {
|
||||
if ((result = isRelatedTo(getConstraintTypeFromMappedType(<MappedType>target), getConstraintTypeFromMappedType(<MappedType>source), reportErrors)) &&
|
||||
(result = isRelatedTo(getTemplateTypeFromMappedType(<MappedType>source), getTemplateTypeFromMappedType(<MappedType>target), reportErrors))) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user