Description
This must have been discussed here, but I couldn't find that discussion. So what's the reason for not supporting es6 generators when targeting es5?
In my spare time I'm writing a tsumego (it's like a mating problem in chess) solver in js which is supposed to be run on a tsumego hosting site like goproblems. This means that the solver must be es5-compatible. The solver itself is a fairly complicated variation of the depth-first search which is, obviously, recursive and can easily go 30-40 stack frames deep. Debugging such a recursive algorithm is a nightmare. I obviously needed a way to implement a special tsumego debugger that would let me use F10, F11, Shift+F11 to suspend and resume the solver at some interesting locations in the search tree, but a conventional recursive function doesn't allow to do that: it either runs to the end or just hangs due to some bug causing a tricky infinite loop 30-or-so levels deep in the search tree. So I had to rewrite the solver in a non recusrive form, which made it much less elegant. Today I've realized that what I actually needed is a recursive generator that would yield at every node in the search tree and yield* itself when it needs to go deeper.
I'm aware of transpilers like traceur that can do this transformation, but I'm afraid that this won't work with tsc well: if I write yiled* in a ts file, vs2015 will complain about the syntax, tsc will simply fail and traceur won't be able to do much due to ts-specific type annotations.