File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 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 {
28342834 return findAncestor(errorBindingElement, isBindingElement) !== findAncestor(declaration, isBindingElement) ||
28352835 declaration.pos < errorBindingElement.pos;
28362836 }
2837+ const rootDeclaration = getRootDeclaration(declaration) as Declaration;
2838+ if (rootDeclaration.kind !== SyntaxKind.VariableDeclaration) {
2839+ return true;
2840+ }
28372841 // 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);
28392843 }
28402844 else if (declaration.kind === SyntaxKind.VariableDeclaration) {
28412845 // 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