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 {
1468114681 // a possible discriminant if its type differs in the constituents of containing union type, and if every
1468214682 // choice is a unit type or a union of unit types.
1468314683 function containsMatchingReferenceDiscriminant(source: Node, target: Node) {
14684+ let name;
1468414685 return isAccessExpression(target) &&
1468514686 containsMatchingReference(source, target.expression) &&
14686- isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), getAccessedPropertyName(target));
14687+ (name = getAccessedPropertyName(target)) !== undefined &&
14688+ isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), name);
1468714689 }
1468814690
1468914691 function getDeclaredTypeOfReference(expr: Node): Type | undefined {
@@ -14714,8 +14716,8 @@ namespace ts {
1471414716 return false;
1471514717 }
1471614718
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) {
1471914721 const prop = getUnionOrIntersectionProperty(<UnionType>type, name);
1472014722 if (prop && getCheckFlags(prop) & CheckFlags.SyntheticProperty) {
1472114723 if ((<TransientSymbol>prop).isDiscriminantProperty === undefined) {
You can’t perform that action at this time.
0 commit comments