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 authored and GitHub committed 2021-11-02 06:54:35 -07:00
1 parent 2424d0e575
commit 7cbcfeea99
6 files changed
+141 -1

No files matched your search

+1 -1
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);