mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 21:36:50 -05:00
Consider for-in and for-of variables to be definitely assigned
This commit is contained in:
@@ -7525,6 +7525,10 @@ namespace ts {
|
||||
if (!declaration || declaration.kind !== SyntaxKind.VariableDeclaration || (<VariableDeclaration>declaration).initializer) {
|
||||
return;
|
||||
}
|
||||
const parentParentKind = declaration.parent.parent.kind;
|
||||
if (parentParentKind === SyntaxKind.ForOfStatement || parentParentKind === SyntaxKind.ForInStatement) {
|
||||
return;
|
||||
}
|
||||
const declarationContainer = getContainingFunction(declaration) || getSourceFileOfNode(declaration);
|
||||
const referenceContainer = getContainingFunction(reference) || getSourceFileOfNode(reference);
|
||||
if (declarationContainer !== referenceContainer) {
|
||||
|
||||
Reference in New Issue
Block a user