Exclude identity relation from mapped type relation check (#46632)

* Exclude identity relation from mapped type relation check

* Add regression test
This commit is contained in:
Anders Hejlsberg
2021-11-02 06:54:35 -07:00
committed by GitHub
parent 2424d0e575
commit 7cbcfeea99
6 changed files with 141 additions and 1 deletions

View File

@@ -19046,7 +19046,7 @@ namespace ts {
originalErrorInfo = undefined;
}
}
else if (isGenericMappedType(target)) {
else if (isGenericMappedType(target) && relation !== identityRelation) {
// Check if source type `S` is related to target type `{ [P in Q]: T }` or `{ [P in Q as R]: T}`.
const keysRemapped = !!target.declaration.nameType;
const templateType = getTemplateTypeFromMappedType(target);