Skip to content

Commit 3ede924

Browse files
TypeScript Botahejlsberg
TypeScript Bot
andauthored
🤖 Pick PR microsoft#53012 (Omit intersection property check wh...) into release-5.0 (microsoft#53024)
Co-authored-by: Anders Hejlsberg <[email protected]>
1 parent 89515ce commit 3ede924

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

‎src/compiler/checker.ts

+1-1
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
}

‎tests/baselines/reference/normalizedIntersectionTooComplex.errors.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
tests/cases/compiler/normalizedIntersectionTooComplex.ts(36,14): error TS2590: Expression produces a union type that is too complex to represent.
21
tests/cases/compiler/normalizedIntersectionTooComplex.ts(36,40): error TS7006: Parameter 'x' implicitly has an 'any' type.
2+
tests/cases/compiler/normalizedIntersectionTooComplex.ts(36,40): error TS2590: Expression produces a union type that is too complex to represent.
33

44

55
==== tests/cases/compiler/normalizedIntersectionTooComplex.ts (2 errors) ====
@@ -39,8 +39,8 @@ tests/cases/compiler/normalizedIntersectionTooComplex.ts(36,40): error TS7006: P
3939
declare var all: keyof Big;
4040
const ctor = getCtor(all);
4141
const comp = ctor({ common: "ok", ref: x => console.log(x) });
42-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43-
!!! error TS2590: Expression produces a union type that is too complex to represent.
4442
~
4543
!!! error TS7006: Parameter 'x' implicitly has an 'any' type.
44+
~~~~~~~~~~~~~~~~~~~
45+
!!! error TS2590: Expression produces a union type that is too complex to represent.
4646

0 commit comments

Comments
 (0)