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 @@ -8920,6 +8920,7 @@ namespace ts {
8920
8920
const isParameter = getRootDeclaration(declaration).kind === SyntaxKind.Parameter;
8921
8921
const declarationContainer = getControlFlowContainer(declaration);
8922
8922
let flowContainer = getControlFlowContainer(node);
8923
+ const isOuterVariable = flowContainer !== declarationContainer;
8923
8924
// When the control flow originates in a function expression or arrow function and we are referencing
8924
8925
// a const variable or parameter from an outer function, we extend the origin of the control flow
8925
8926
// analysis to include the immediately enclosing function.
@@ -8932,7 +8933,7 @@ namespace ts {
8932
8933
// the entire control flow graph from the variable's declaration (i.e. when the flow container and
8933
8934
// declaration container are the same).
8934
8935
const assumeInitialized = !strictNullChecks || (type.flags & TypeFlags.Any) !== 0 || isParameter ||
8935
- flowContainer !== declarationContainer || isInAmbientContext(declaration);
8936
+ isOuterVariable || isInAmbientContext(declaration);
8936
8937
const flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer);
8937
8938
// A variable is considered uninitialized when it is possible to analyze the entire control flow graph
8938
8939
// 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