Missing parentheses around `yield*` used as a tagged-template tag changes runtime behavior
Author: colecrouterCreated Sep 16, 2026Updated Sep 16, 2026
Valid generator code returns true before minification and throws TypeError after minification. This reproduces with compression and mangling both disabled.
Before:
function* run(service) {
return (yield* (yield* service)`x`).length > 0;
}After:
function*run(n){return(yield*yield*n`x`).length>0}Expected result
Preserve the grouping that makes the yielded value the tag, for example:
function*run(service){return(yield*(yield*service)`x`).length>0}The output currently reparses with service itself as the tag instead of the inner yield* expression.
Source: terser/terser