TypeScript Version: 2.1.4
Code
functionbaz(x: any){return[[x,x]];}functionfoo(set: any){for(const[value,i]ofbaz(set.values)){constbar: any=[];(()=>bar);set.values.push(...[]);}};Expected behavior:
Names of hidden/implementation variables should not clash.
Actual behavior:
Two _a hidden variables are created which would be in different scopes under ES6 let/const but are in the same scope since they are var:
functionbaz(x){return[[x,x]];}functionfoo(set){var_loop_1=function(value,i){varbar=[];(function(){returnbar;});(_a=set.values).push.apply(_a,[]);};for(var_i=0,_a=baz(set.values);_i<_a.length;_i++){var_b=_a[_i],value=_b[0],i=_b[1];_loop_1(value,i);}var_a;};Note:
After pruning my code to isolate the issue, I'm not sure what the impact of the collision is anymore, but in my original code I was getting an infinite loop due to the loop index being part of the collision. I should be able to produce a short example like that if needed.
TypeScript Version: 2.1.4
Code
Expected behavior:
Names of hidden/implementation variables should not clash.
Actual behavior:
Two
_ahidden variables are created which would be in different scopes under ES6let/constbut are in the same scope since they arevar:Note:
After pruning my code to isolate the issue, I'm not sure what the impact of the collision is anymore, but in my original code I was getting an infinite loop due to the loop index being part of the collision. I should be able to produce a short example like that if needed.