TypeScript: `import x = A.x` syntax should always be converted to a var declaration
Author: chirsz-everCreated Apr 13, 2026Updated Aug 28, 2026
Example input code:
namespace A {
export var x = 0;
}
import x = A.x;
console.log(x);TypeScript 6.0.2 with "target": "ES2020" (playground):
"use strict";
var A;
(function (A) {
A.x = 0;
})(A || (A = {}));
var x = A.x;
console.log(x);esbuild 0.28.0 with --target=es2020 (playground):
var A;
((A2) => {
A2.x = 0;
})(A || (A = {}));
const x = A.x;
console.log(x);Source: evanw/esbuild