File tree 1 file changed +2
-1
lines changed 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -8881,6 +8881,7 @@ namespace ts {
8881
8881
const isParameter = getRootDeclaration(declaration).kind === SyntaxKind.Parameter;
8882
8882
const declarationContainer = getControlFlowContainer(declaration);
8883
8883
let flowContainer = getControlFlowContainer(node);
8884
+ const isOuterVariable = flowContainer !== declarationContainer;
8884
8885
// When the control flow originates in a function expression or arrow function and we are referencing
8885
8886
// a const variable or parameter from an outer function, we extend the origin of the control flow
8886
8887
// analysis to include the immediately enclosing function.
@@ -8893,7 +8894,7 @@ namespace ts {
8893
8894
// the entire control flow graph from the variable's declaration (i.e. when the flow container and
8894
8895
// declaration container are the same).
8895
8896
const assumeInitialized = !strictNullChecks || (type.flags & TypeFlags.Any) !== 0 || isParameter ||
8896
- flowContainer !== declarationContainer || isInAmbientContext(declaration);
8897
+ isOuterVariable || isInAmbientContext(declaration);
8897
8898
const flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer);
8898
8899
// A variable is considered uninitialized when it is possible to analyze the entire control flow graph
8899
8900
// from declaration to use, and when the variable's declared type doesn't include undefined but the
You can’t perform that action at this time.
0 commit comments