TypeScript Version: 3.5.1, 3.6.0-dev.20190530
Search Terms:
declaration, generated types, incorrect default export
Code
function A() { }
function B() { }
export function C() {
return null;
}
C.A = A;
C.B = B;
run tsc --declaration
// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.
Expected behavior:
declare function A(): void;
declare function B(): void;
export declare function C(): null;
export declare namespace C {
var A: typeof A;
var B: typeof B;
}
Actual behavior:
declare function A(): void;
declare function B(): void;
declare function C(): null;
declare namespace C {
var A: typeof A;
var B: typeof B;
}
export default C;
Typescript 3.5.1 is adding a default export which is incorrect.
Playground Link:
Related Issues:
It's fine in TS ~3.4 btw.
This breaks a lot of monorepos using project references since they all rely on declaration files. This makes 3.5 unusable for us. Otherwise no problems with the migration though.
A workaround for now,
https://github.com/microsoft/TypeScript/issues/31918#issuecomment-502354686
Cool! Thanks for fixing @weswigham
I see the 3.6 milestone is linked here. Would it be possible to get this in a patch release instead? I'm pretty desprerate 馃槄
cc @DanielRosenwasser
Thanks! This issue is now fixed in TS 3.5.3
Most helpful comment
Thanks! This issue is now fixed in TS 3.5.3