Skip to content

Declaration emit for aliased exports used in export assignments is broken #19825

@weswigham

Description

@weswigham

TypeScript Version: 2.7.0-dev.201xxxxx

Code

// @declaration: true
// @filename: /a.ts
class C {}
export { C as D }

// @filename: /b.ts
import * as a from "./a";
export default a.D;

Expected behavior:

// /a.d.ts
declare class C {}
export { C as D }
// /b.d.ts 
import * as a from "./a";
declare const _default: typeof a.D;
export default _default;

Actual behavior:

/b.ts(2,1): error TS4082: Default export of the module has or is using private name 'default'.


==== /a.ts (0 errors) ====
    class C {}
    export { C as D }
    
==== /b.ts (1 errors) ====
    import * as a from "./a";
    export default a.D;
    ~~~~~~~~~~~~~~~~~~~
!!! error TS4082: Default export of the module has or is using private name 'default'.

I think #19428 may have been an indicator of a larger issue, and the fix applied for it may have been too narrow (or it may be unrelated, haven't run a bisect yet). I've been having issues merging the fix into the symbol display builder PR (since it either fixes the observed bug and breaks all the type/symbol baselines or doesn't fix the bug, depending on how I merge it), so to track down how to implement the fix in the node builder instead of the symbol display builder I started looking for similar cases to see how we behave and found this.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions