@@ -11711,21 +11711,21 @@ namespace ts {
11711
11711
}
11712
11712
11713
11713
function isApparentTypePosition(node: Node) {
11714
- // When a node is the left hand expression of a property access or call expression, the node occurs
11715
- // in an apparent type position. In such a position we fetch the apparent type of the node *before*
11716
- // performing control flow analysis such that, if the node is a type variable, we apply narrowings
11717
- // to the constraint type.
11718
11714
const parent = node.parent;
11719
11715
return parent.kind === SyntaxKind.PropertyAccessExpression ||
11720
11716
parent.kind === SyntaxKind.CallExpression && (<CallExpression>parent).expression === node ||
11721
11717
parent.kind === SyntaxKind.ElementAccessExpression && (<ElementAccessExpression>parent).expression === node;
11722
11718
}
11723
11719
11724
11720
function getDeclaredOrApparentType(symbol: Symbol, node: Node) {
11721
+ // When a node is the left hand expression of a property access, element access, or call expression,
11722
+ // and the type of the node includes type variables with constraints that are nullable, we fetch the
11723
+ // apparent type of the node *before* performing control flow analysis such that narrowings apply to
11724
+ // the constraint type.
11725
11725
const type = getTypeOfSymbol(symbol);
11726
11726
if (isApparentTypePosition(node) && maybeTypeOfKind(type, TypeFlags.TypeVariable)) {
11727
11727
const apparentType = mapType(getWidenedType(type), getApparentType);
11728
- if (apparentType !== emptyObjectType ) {
11728
+ if (maybeTypeOfKind( apparentType, TypeFlags.Nullable) ) {
11729
11729
return apparentType;
11730
11730
}
11731
11731
}
0 commit comments