Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2983c85

Browse files
committedFeb 28, 2023
Omit intersection property check when source includes target
1 parent c97ddac commit 2983c85

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21117,7 +21117,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2111721117
//
2111821118
else if (result && isNonGenericObjectType(target) && !isArrayOrTupleType(target) &&
2111921119
source.flags & TypeFlags.Intersection && getApparentType(source).flags & TypeFlags.StructuredType &&
21120-
!some((source as IntersectionType).types, t => !!(getObjectFlags(t) & ObjectFlags.NonInferrableType))) {
21120+
!some((source as IntersectionType).types, t => t === target || !!(getObjectFlags(t) & ObjectFlags.NonInferrableType))) {
2112121121
result &= propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, /*optionalsOnly*/ true, intersectionState);
2112221122
}
2112321123
}

0 commit comments

Comments
 (0)
Please sign in to comment.