3 ms·
TypeScript now supports using ‘let’ and ‘const’ in addition to ‘var’. These currently require the ES6 output mode, but we’re are investigating relaxing this
by xxyyzz3d 12y ago
TypeScript now supports using ‘let’ and ‘const’ in addition
to ‘var’. These currently require the ES6 output mode, but
we’re are investigating relaxing this restriction in future
versions.
Would be quite nice to be able to use 'let', and just use variable renaming to generate ES5 code with unique names in the case where scopes overlap. I guess it might be coming?
- skrebbel 12y agoYou could probably use TS's ES6 output and pipe it into Traceur or 6to5 or something.
- Arnavion 12y agoVariable hygiene is not sufficient in loops - you have to make IIFE's for that. Then you have to account that the code inside that IIFE might be referring to the arguments object of the outer function, so you have to forward the outer arguments object to the IIFE as well. It's not impossible but the end result is somewhat gnarly.