File tree 1 file changed +5
-1
lines changed
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -2834,8 +2834,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2834
2834
return findAncestor(errorBindingElement, isBindingElement) !== findAncestor(declaration, isBindingElement) ||
2835
2835
declaration.pos < errorBindingElement.pos;
2836
2836
}
2837
+ const rootDeclaration = getRootDeclaration(declaration) as Declaration;
2838
+ if (rootDeclaration.kind !== SyntaxKind.VariableDeclaration) {
2839
+ return true;
2840
+ }
2837
2841
// or it might be illegal if usage happens before parent variable is declared (eg var [a] = a)
2838
- return isBlockScopedNameDeclaredBeforeUse(getAncestor(declaration, SyntaxKind.VariableDeclaration) as Declaration , usage);
2842
+ return isBlockScopedNameDeclaredBeforeUse(rootDeclaration , usage);
2839
2843
}
2840
2844
else if (declaration.kind === SyntaxKind.VariableDeclaration) {
2841
2845
// still might be illegal if usage is in the initializer of the variable declaration (eg var a = a)
You can’t perform that action at this time.
0 commit comments