File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -14681,9 +14681,11 @@ namespace ts {
14681
14681
// a possible discriminant if its type differs in the constituents of containing union type, and if every
14682
14682
// choice is a unit type or a union of unit types.
14683
14683
function containsMatchingReferenceDiscriminant(source: Node, target: Node) {
14684
+ let name;
14684
14685
return isAccessExpression(target) &&
14685
14686
containsMatchingReference(source, target.expression) &&
14686
- isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), getAccessedPropertyName(target));
14687
+ (name = getAccessedPropertyName(target)) !== undefined &&
14688
+ isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), name);
14687
14689
}
14688
14690
14689
14691
function getDeclaredTypeOfReference(expr: Node): Type | undefined {
@@ -14714,8 +14716,8 @@ namespace ts {
14714
14716
return false;
14715
14717
}
14716
14718
14717
- function isDiscriminantProperty(type: Type | undefined, name: __String | undefined ) {
14718
- if (type && name && type.flags & TypeFlags.Union) {
14719
+ function isDiscriminantProperty(type: Type | undefined, name: __String) {
14720
+ if (type && type.flags & TypeFlags.Union) {
14719
14721
const prop = getUnionOrIntersectionProperty(<UnionType>type, name);
14720
14722
if (prop && getCheckFlags(prop) & CheckFlags.SyntheticProperty) {
14721
14723
if ((<TransientSymbol>prop).isDiscriminantProperty === undefined) {
You can’t perform that action at this time.
0 commit comments