File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -8920,6 +8920,7 @@ namespace ts {
89208920 const isParameter = getRootDeclaration(declaration).kind === SyntaxKind.Parameter;
89218921 const declarationContainer = getControlFlowContainer(declaration);
89228922 let flowContainer = getControlFlowContainer(node);
8923+ const isOuterVariable = flowContainer !== declarationContainer;
89238924 // When the control flow originates in a function expression or arrow function and we are referencing
89248925 // a const variable or parameter from an outer function, we extend the origin of the control flow
89258926 // analysis to include the immediately enclosing function.
@@ -8932,7 +8933,7 @@ namespace ts {
89328933 // the entire control flow graph from the variable's declaration (i.e. when the flow container and
89338934 // declaration container are the same).
89348935 const assumeInitialized = !strictNullChecks || (type.flags & TypeFlags.Any) !== 0 || isParameter ||
8935- flowContainer !== declarationContainer || isInAmbientContext(declaration);
8936+ isOuterVariable || isInAmbientContext(declaration);
89368937 const flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer);
89378938 // A variable is considered uninitialized when it is possible to analyze the entire control flow graph
89388939 // 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