-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts filesDomain: JavaScriptThe issue relates to JavaScript specificallyThe issue relates to JavaScript specificallyFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
TypeScript Version: Nightly
Search Terms: export instance of class
Code
class Foo {
}
module.exports = new Foo();
Expected behavior:
.d.ts
declare const _exports: Foo;
export = _exports;
declare class Foo {
}
Actual behavior:
.d.ts
declare const _exports: typeof Foo;
export = _exports;
declare class Foo {
}
The consequence of this issue is that when I import the exported object from another package, typescript incorrectly treats the imported object as though it is the class and not an instance of the class.
Related Issues: None found
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts filesDomain: JavaScriptThe issue relates to JavaScript specificallyThe issue relates to JavaScript specificallyFix AvailableA PR has been opened for this issueA PR has been opened for this issue