Closed
Description
openedon Dec 16, 2016
TypeScript Version: 2.1.4
(0,eval)('var x = 10');
Expected behavior:
Compile fine.
Actual behavior:
error TS2695: Left side of comma operator is unused and has no side effects.
See also at TS Playground.
(0,eval)
is a well-used convenience syntax for invoking eval
with a global scope (as opposed to the scope of the caller).
One possible workaround is: (eval||null)
. But that's longer and most of all — hard to Google the reasoning behind. Whereas (0,eval)
is easy to find a detailed explanation for.
Please make it not error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment