mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
Omit intersection property check when source includes target (#53012)
This commit is contained in:
parent
e2283e99b4
commit
74814345ce
@ -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.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user