TypeScript Version: 4.2.0-dev.20201112
Search Terms: esm, importHelpers, unused
Code
// @importHelpers: true
// @module: es2015
// @target: es5
// @downlevelIteration: true
const a = [1, 2];
const b = [3, 4]
export const c = [...a, ...b];
Expected behavior:
Imports only the used helpers:
import { __spread } from "tslib";
var a = [1, 2];
var b = [3, 4];
export var c = __spread(a, b);
Actual behavior:
Imports the used helpers and also the helpers they depend on:
import { __read, __spread } from "tslib";
var a = [1, 2];
var b = [3, 4];
export var c = __spread(a, b);
Note the extra unused import in the first line.
Playground Link: https://www.typescriptlang.org/play?downlevelIteration=true&importHelpers=true&target=1&module=5&ts=4.2.0-dev.20201112#code/MYewdgzgLgBAhjAvDA2gRgDQwEwF0DcAUKJLAEZKoDMWALLoQKYAeADiAE6wnQzCUoAdMLhZhgsgSA
Additional info: I already have a fix for this ready; basically I'm just following protocol, waiting for approval.
TypeScript Version: 4.2.0-dev.20201112
Search Terms: esm, importHelpers, unused
Code
Expected behavior:
Imports only the used helpers:
Actual behavior:
Imports the used helpers and also the helpers they depend on:
Note the extra unused import in the first line.
Playground Link: https://www.typescriptlang.org/play?downlevelIteration=true&importHelpers=true&target=1&module=5&ts=4.2.0-dev.20201112#code/MYewdgzgLgBAhjAvDA2gRgDQwEwF0DcAUKJLAEZKoDMWALLoQKYAeADiAE6wnQzCUoAdMLhZhgsgSA
Additional info: I already have a fix for this ready; basically I'm just following protocol, waiting for approval.