Open
Description
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.
Additional info: I already have a fix for this ready; basically I'm just following protocol, waiting for approval.