Skip to content

TypeScript: import x = A.x syntax should always be converted to a var declaration #4449

@chirsz-ever

Description

@chirsz-ever

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions