Skip to content

Commit ee0b7e2

Browse files
committed
Do not check intersections or unions to ignore propegating reference flags, properly set comparing jsx flag
1 parent bdabb0f commit ee0b7e2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15363,12 +15363,12 @@ namespace ts {
1536315363
function isRelatedTo(originalSource: Type, originalTarget: Type, reportErrors = false, headMessage?: DiagnosticMessage, intersectionState = IntersectionState.None): Ternary {
1536415364
// Before normalization: if `source` is type reference (ergo an object), and `target` is primitive,
1536515365
// skip all the checks we don't need and just return `isSimpleTypeRelatedTo` result
15366-
if (getObjectFlags(originalSource) & ObjectFlags.Reference && originalTarget.flags & TypeFlags.Primitive) {
15366+
if (!(originalSource.flags & TypeFlags.UnionOrIntersection) && getObjectFlags(originalSource) & ObjectFlags.Reference && originalTarget.flags & TypeFlags.Primitive) {
1536715367
if (isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors ? reportError : undefined)) {
1536815368
return Ternary.True;
1536915369
}
1537015370
else {
15371-
reportErrorResults(originalSource, originalTarget, Ternary.False, /*isComparingJsxAttributes*/ true);
15371+
reportErrorResults(originalSource, originalTarget, Ternary.False, !!(getObjectFlags(originalSource) & ObjectFlags.JsxAttributes));
1537215372
return Ternary.False;
1537315373
}
1537415374
}

0 commit comments

Comments
 (0)