mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-04-17 13:48:46 -05:00
Non-fresh {} is not a subtype of { [x: string]: xxx }
This commit is contained in:
@@ -20621,7 +20621,8 @@ namespace ts {
|
||||
if (sourceInfo) {
|
||||
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors);
|
||||
}
|
||||
if (!(intersectionState & IntersectionState.Source) && isObjectTypeWithInferableIndex(source)) {
|
||||
if (!(intersectionState & IntersectionState.Source) && isObjectTypeWithInferableIndex(source) &&
|
||||
!((relation === subtypeRelation || relation === strictSubtypeRelation) && isEmptyAnonymousObjectType(source) && !(getObjectFlags(source) & ObjectFlags.FreshLiteral))) {
|
||||
// Intersection constituents are never considered to have an inferred index signature
|
||||
return membersRelatedToIndexInfo(source, targetInfo, reportErrors);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user