@@ -4309,7 +4309,7 @@ namespace ts {
43094309 parentType = getNonNullableType(parentType);
43104310 }
43114311 const propType = getTypeOfPropertyOfType(parentType, text);
4312- const declaredType = propType && getDeclaredOrApparentType (propType, declaration.name);
4312+ const declaredType = propType && getApparentTypeForPosition (propType, declaration.name);
43134313 type = declaredType && getFlowTypeOfReference(declaration, declaredType) ||
43144314 isNumericLiteralName(text) && getIndexTypeOfType(parentType, IndexKind.Number) ||
43154315 getIndexTypeOfType(parentType, IndexKind.String);
@@ -13162,7 +13162,7 @@ namespace ts {
1316213162 return type.flags & TypeFlags.TypeVariable && maybeTypeOfKind(getBaseConstraintOfType(type) || emptyObjectType, TypeFlags.Nullable);
1316313163 }
1316413164
13165- function getDeclaredOrApparentType (type: Type, node: Node) {
13165+ function getApparentTypeForPosition (type: Type, node: Node) {
1316613166 // When a node is the left hand expression of a property access, element access, or call expression,
1316713167 // and the type of the node includes type variables with constraints that are nullable, we fetch the
1316813168 // apparent type of the node *before* performing control flow analysis such that narrowings apply to
@@ -13256,7 +13256,7 @@ namespace ts {
1325613256 checkCollisionWithCapturedNewTargetVariable(node, node);
1325713257 checkNestedBlockScopedBinding(node, symbol);
1325813258
13259- const type = getDeclaredOrApparentType (getTypeOfSymbol(localOrExportSymbol), node);
13259+ const type = getApparentTypeForPosition (getTypeOfSymbol(localOrExportSymbol), node);
1326013260 const assignmentKind = getAssignmentTargetKind(node);
1326113261
1326213262 if (assignmentKind) {
@@ -15808,7 +15808,7 @@ namespace ts {
1580815808 return unknownType;
1580915809 }
1581015810 }
15811- propType = getDeclaredOrApparentType (getTypeOfSymbol(prop), node);
15811+ propType = getApparentTypeForPosition (getTypeOfSymbol(prop), node);
1581215812 }
1581315813 // Only compute control flow type if this is a property access expression that isn't an
1581415814 // assignment target, and the referenced property was declared as a variable, property,
0 commit comments