Skip to content

Declaration emit drops expando function properties whose assignments are not top-level expression statements #4118

@mds-ant

Description

@mds-ant

Steps to reproduce

main.ts:

function Foo(): void { }
Foo.top = 1;
let d: number = (Foo.inInitializer = 2);
if (true) {
    Foo.inBlock = 3;
}
tsgo --declaration main.ts

Behavior with typescript@6.0

declare function Foo(): void;
declare namespace Foo {
    var top: number;
    var inInitializer: number;
    var inBlock: number;
}
declare let d: number;

Behavior with tsgo

declare function Foo(): void;
declare namespace Foo {
    var top: number;
}
declare let d: number;

Metadata

Metadata

Assignees

Labels

Domain: Declaration EmitRelated to declaration emit, type printingbugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions