Skip to content

Commit a3062b6

Browse files
committed
Check other cases
1 parent 98ad12e commit a3062b6

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
@@ -19319,7 +19319,7 @@ namespace ts {
1931919319
if (isMatchingReference(reference, expr)) {
1932019320
return getTypeWithFacts(type, assumeTrue ? TypeFacts.Truthy : TypeFacts.Falsy);
1932119321
}
19322-
if (isMatchingReferenceDiscriminant(expr, declaredType)) {
19322+
if (isMatchingReferenceDiscriminant(expr, containingUnion || declaredType)) {
1932319323
return narrowTypeByDiscriminant(type, <AccessExpression>expr, t => getTypeWithFacts(t, assumeTrue ? TypeFacts.Truthy : TypeFacts.Falsy));
1932419324
}
1932519325
if (containsMatchingReferenceDiscriminant(reference, expr)) {
@@ -19795,7 +19795,7 @@ namespace ts {
1979519795
if (isMatchingReference(reference, expr)) {
1979619796
return getTypeWithFacts(type, assumePresent ? TypeFacts.NEUndefinedOrNull : TypeFacts.EQUndefinedOrNull);
1979719797
}
19798-
if (isMatchingReferenceDiscriminant(expr, declaredType)) {
19798+
if (isMatchingReferenceDiscriminant(expr, containingUnion || declaredType)) {
1979919799
return narrowTypeByDiscriminant(type, <AccessExpression>expr, t => getTypeWithFacts(t, assumePresent ? TypeFacts.NEUndefinedOrNull : TypeFacts.EQUndefinedOrNull));
1980019800
}
1980119801
if (containsMatchingReferenceDiscriminant(reference, expr)) {

0 commit comments

Comments
 (0)