timocov / dts-bundle-generator

A tool to generate a single bundle of dts with types tree-shaking
MIT License
744 stars 38 forks source link

Exporting class/variable/function as type exports it as value too #290

Open timocov opened 8 months ago

timocov commented 8 months ago

Bug report

Input code

class Foobar {}

export function makeFoobar(): Foobar {
    return new Foobar();
}

export { type Foobar };

Expected output

declare class Foobar {
}
export declare function makeFoobar(): Foobar;

export {
    type Foobar,
};

export {};

Actual output

export declare class Foobar {
}
export declare function makeFoobar(): Foobar;

export {};
timocov commented 8 months ago

Waiting for the resolution on https://github.com/microsoft/TypeScript/issues/57032