Skip to content

[feat] treat typescript namespace like import * as foo from 'foo' which refer to ImportNamespaceSpecifier in AST #3077

@loynoir

Description

@loynoir

Reproduce

$ npm exec -- esbuild --format=esm --bundle ./entry.mts
==> entry.mts <==
import TypeRegistry from './lib.mjs'

TypeRegistry.Clear()

==> lib.mts <==
const map = new Map<string, unknown>()

function Entries() {
  return new Map(map)
}

function Clear() {
  return map.clear()
}

export default /* @__PURE__ */{ Entries, Clear }

Actual

// lib.mts
var map = /* @__PURE__ */ new Map();
function Entries() {
  return new Map(map);
}
function Clear() {
  return map.clear();
}
var lib_default = { Entries, Clear };

// entry.mts
lib_default.Clear();

Expected

// lib.mts
var map = /* @__PURE__ */ new Map();
function Clear() {
  return map.clear();
}
var lib_default = { Clear };

// entry.mts
lib_default.Clear();

Related

sinclairzx81/typebox#401

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