Skip to content

Make exported consts better minifiable #7565

Closed as not planned
Closed as not planned
@chrmarti

Description

@chrmarti

TypeScript Version:

1.8.2 (Playground on 20160317)

Code

module Some {
    export const thing = "";
}

Expected behavior:

Should compile to:

var Some;
(function (Some) {
    var thing = "";
    Some.thing = thing;
})(Some || (Some = {}));

So internal references can use the local variable which will minify well. Exported functions and classes already compile minifier-friendly.

Actual behavior:

But compiles to:

var Some;
(function (Some) {
    Some.thing = "";
})(Some || (Some = {}));

So internal references use the nested reference which does not minify.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions