Fix misleading error TS2410 from issue #10601

This commit is contained in:
Lukas Elmer
2016-09-27 12:32:48 +02:00
committed by Lukas Elmer
parent 60ab007d3a
commit 3bd2226e35
21 changed files with 77 additions and 71 deletions

View File

@@ -16499,7 +16499,13 @@ namespace ts {
}
checkExpression(node.expression);
error(node.expression, Diagnostics.All_symbols_within_a_with_block_will_be_resolved_to_any);
const sourceFile = getSourceFileOfNode(node);
if (!hasParseDiagnostics(sourceFile)) {
const start = getSpanOfTokenAtPosition(sourceFile, node.pos).start;
const end = node.statement.pos;
grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Unsupported_with_statement_all_symbols_within_a_with_block_will_be_resolved_to_any);
}
}
function checkSwitchStatement(node: SwitchStatement) {

View File

@@ -1279,7 +1279,7 @@
"category": "Error",
"code": 2409
},
"All symbols within a 'with' block will be resolved to 'any'.": {
"Unsupported 'with' statement, all symbols within a 'with' block will be resolved to 'any'.": {
"category": "Error",
"code": 2410
},