mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
do not report error on non-initialized const bindings in for-in\for-of statements
This commit is contained in:
parent
33dfe5068a
commit
32aef1a031
@ -11498,7 +11498,8 @@ module ts {
|
||||
if (isBindingPattern(node.name) && !isBindingPattern(node.parent)) {
|
||||
return grammarErrorOnNode(node, Diagnostics.A_destructuring_declaration_must_have_an_initializer);
|
||||
}
|
||||
if (isConst(node)) {
|
||||
// const declarations should not be initialized in for-in for-of statements
|
||||
if (isConst(node) && node.parent.parent.kind !== SyntaxKind.ForInStatement && node.parent.parent.kind !== SyntaxKind.ForOfStatement) {
|
||||
return grammarErrorOnNode(node, Diagnostics.const_declarations_must_be_initialized);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user