unbuild icon indicating copy to clipboard operation
unbuild copied to clipboard

Types in `d.cts` is incorrect when the entry has multiple exports

Open sapphi-red opened this issue 7 months ago • 3 comments

Environment

Node 22.15.0 unbuild 3.5.0

Reproduction

https://stackblitz.com/edit/node-vefv5aqh?file=package.json,build.config.ts&terminal=build

Describe the bug

The CJS output has

exports.default = d;
exports.foo = foo;

but the types (index.d.cts, index.d.ts) has

export = d;
export { foo };

I think the correct type for this CJS file is:

export = { default: d, foo }

Additional context

I guess the related changes are #458 and #513

Logs


sapphi-red avatar Apr 24 '25 08:04 sapphi-red