We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e130cd6 commit e91ee14Copy full SHA for e91ee14
src/compiler/checker.ts
@@ -16184,7 +16184,10 @@ namespace ts {
16184
}
16185
let propType;
16186
return isMatchingReference(reference, expr.expression) &&
16187
- (isDiscriminantProperty(computedType, name) || (propType = getTypeOfPropertyOfType(computedType, name)) && isUnitType(propType));
+ (isDiscriminantProperty(computedType, name) ||
16188
+ ((computedType.flags & TypeFlags.UnionOrIntersection) === 0) &&
16189
+ (propType = getTypeOfPropertyOfType(computedType, name))
16190
+ && isUnitType(propType));
16191
16192
16193
function narrowTypeByDiscriminant(type: Type, access: AccessExpression, narrowType: (t: Type) => Type): Type {
0 commit comments