Consider for-in and for-of variables to be definitely assigned
This commit is contained in:
parent
1302418776
commit
d6fcd1af1b
1 changed files with 4 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue