🤖 Pick PR #53012 (Omit intersection property check wh...) into release-5.0 (#53024)

Co-authored-by: Anders Hejlsberg <andersh@microsoft.com>
This commit is contained in:
TypeScript BotandAnders Hejlsberg authored and GitHub committed 2023-03-02 12:36:57 -08:00
1 parent 89515ce7e3
commit 3ede9245ce
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -21117,7 +21117,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
//
else if (result && isNonGenericObjectType(target) && !isArrayOrTupleType(target) &&
source.flags & TypeFlags.Intersection && getApparentType(source).flags & TypeFlags.StructuredType &&
!some((source as IntersectionType).types, t => !!(getObjectFlags(t) & ObjectFlags.NonInferrableType))) {
!some((source as IntersectionType).types, t => t === target || !!(getObjectFlags(t) & ObjectFlags.NonInferrableType))) {
result &= propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, /*optionalsOnly*/ true, intersectionState);
}
}
@@ -1,5 +1,5 @@
tests/cases/compiler/normalizedIntersectionTooComplex.ts(36,14): error TS2590: Expression produces a union type that is too complex to represent.
tests/cases/compiler/normalizedIntersectionTooComplex.ts(36,40): error TS7006: Parameter 'x' implicitly has an 'any' type.
tests/cases/compiler/normalizedIntersectionTooComplex.ts(36,40): error TS2590: Expression produces a union type that is too complex to represent.
==== tests/cases/compiler/normalizedIntersectionTooComplex.ts (2 errors) ====
@@ -39,8 +39,8 @@ tests/cases/compiler/normalizedIntersectionTooComplex.ts(36,40): error TS7006: P
declare var all: keyof Big;
const ctor = getCtor(all);
const comp = ctor({ common: "ok", ref: x => console.log(x) });
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2590: Expression produces a union type that is too complex to represent.
~
!!! error TS7006: Parameter 'x' implicitly has an 'any' type.
~~~~~~~~~~~~~~~~~~~
!!! error TS2590: Expression produces a union type that is too complex to represent.