Skip to content

Commit 823b220

Browse files
committed
Non-fresh {} is not a subtype of { [x: string]: xxx }
1 parent 7b76416 commit 823b220

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20621,7 +20621,8 @@ namespace ts {
2062120621
if (sourceInfo) {
2062220622
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors);
2062320623
}
20624-
if (!(intersectionState & IntersectionState.Source) && isObjectTypeWithInferableIndex(source)) {
20624+
if (!(intersectionState & IntersectionState.Source) && isObjectTypeWithInferableIndex(source) &&
20625+
!((relation === subtypeRelation || relation === strictSubtypeRelation) && isEmptyAnonymousObjectType(source) && !(getObjectFlags(source) & ObjectFlags.FreshLiteral))) {
2062520626
// Intersection constituents are never considered to have an inferred index signature
2062620627
return membersRelatedToIndexInfo(source, targetInfo, reportErrors);
2062720628
}

0 commit comments

Comments
 (0)