qmhc / vite-plugin-dts

A Vite plugin for generating `.d.ts` files.
MIT License
1.22k stars 84 forks source link

namespace declaration exports two times #352

Closed momokunsu closed 1 month ago

momokunsu commented 1 month ago

Describe the bug

source code:

export namespace Space {
    export let test = "test";
}

exports .d.ts file:

export declare namespace Space {
    let test: string;
}

export { }

export declare namespace Space {
    let test: string;
}

namespace Space has 2 declaration.

this bug also replicate in Reproduction url

Reproduction

https://stackblitz.com/edit/stackblitz-starters-7ejfqm?file=index.ts

Steps to reproduce

No response

System Info

nodejs

Validations

qmhc commented 1 month ago

It seems a bug form api-extractor, see https://github.com/microsoft/rushstack/issues/4807.

momokunsu commented 1 month ago

It seems a bug form api-extractor, see https://github.com/microsoft/rushstack/issues/4807.

It seems that 2 problems, his project makes two packages, and everyone exports one time from the same package names 'package-a'.But my repo just has a single file. Moreover, his result is correct even if that isn't expected. My result has syntax errors of typescript because of redefine namespace members.

momokunsu commented 1 month ago

I changed this plugin version to 3.7.3, and it works. I hope to help you find the real bug.