Add ts.forEachIndex() - enumerates an array and calls a callback with each element and its index.
Don't emit an empty template head literal if there's a template span with a non-empty literal.

Fixes #1570
Update tests.