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.
Playground Link: https://www.typescriptlang.org/play?ts=4.0.0-dev.20200803&useJavaScript=true#code/MYGwhgzhAEBiD29oG8BQ0PVQX1agtvACYCuIApgHTkAeADvAE4AuMAvNAHbkDuciACgCUAbiA
Related Issues: None found
TypeScript Version: Nightly
Search Terms: export instance of class
Code
Expected behavior:
.d.tsActual behavior:
.d.tsThe 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.
Playground Link: https://www.typescriptlang.org/play?ts=4.0.0-dev.20200803&useJavaScript=true#code/MYGwhgzhAEBiD29oG8BQ0PVQX1agtvACYCuIApgHTkAeADvAE4AuMAvNAHbkDuciACgCUAbiA
Related Issues: None found