Avoid failing TS2695 for eval.
This commit is contained in:
parent
fd8040978b
commit
27675fc96e
2 changed files with 4 additions and 1 deletions
|
@ -15929,7 +15929,7 @@ namespace ts {
|
|||
checkAssignmentOperator(rightType);
|
||||
return getRegularTypeOfObjectLiteral(rightType);
|
||||
case SyntaxKind.CommaToken:
|
||||
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left)) {
|
||||
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && right.text!=="eval") {
|
||||
error(left, Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects);
|
||||
}
|
||||
return rightType;
|
||||
|
|
3
tests/cases/compiler/evalAfter0.ts
Normal file
3
tests/cases/compiler/evalAfter0.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
(0,eval)("10");
|
||||
|
||||
(0,alert)("10");
|
Loading…
Reference in a new issue