Skip to content

[3.5.1] Incorrect generated declaration file #31676

Closed
@amanmahajan7

Description

@amanmahajan7

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:

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions