Skip to content

Bad .d.ts emit for class expression on `module.exports #34893

Open
@DanielRosenwasser

Description

@DanielRosenwasser

Repro

module.exports.answer = class C {
    foo = 10;
    bar;
}

Instructions

tsc --declaration --allowJS --outDir lib ./src/foo.js

Current

declare class C {
    foo: number;
    bar: any;
}
export {};

Expected

declare class C {
    foo: number;
    bar: any;
}
export { C as answer };

or

declare class C {
    foo: number;
    bar: any;
}
export var answer: typeof C;

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesDomain: JavaScriptThe issue relates to JavaScript specifically

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions