Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging namespaces optimization #16570

Closed
blendsdk opened this issue Jun 15, 2017 · 2 comments
Closed

Merging namespaces optimization #16570

blendsdk opened this issue Jun 15, 2017 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@blendsdk
Copy link

blendsdk commented Jun 15, 2017

I was wondering if typescript can/will merge classes in the same namespace when module format is set to amd and the results written in a single file?

Given tsconfig.json:

{
    "compilerOptions": {
        "module": "amd",
        "target": "es5",
        ........
        ........
        "outFile": "../../dist/js/app.js"
    },
    "files": [
           "Hammer.ts",
           "Saw.ts"
    ]
}

The generated code is:

var Utils;
(function (Utils) {
    var Hammer = (function () {
        function Hammer() {
        }
        return Hammer;
    }());
    Utils.Hammer = Hammer;
})(Utils || (Utils = {}));
(function (Utils) {
    var Saw = (function () {
        function Saw() {
        }
        return Saw;
    }());
    Utils.Saw = Saw;
})(Utils || (Utils = {}));

This could be merged to something like:

var Utils;
(function (Utils) {

    var Hammer = (function () {
        function Hammer() {
        }
        return Hammer;
    }());
    Utils.Hammer = Hammer;

    var Saw = (function () {
        function Saw() {
        }
        return Saw;
    }());
    Utils.Saw = Saw;
    
})(Utils || (Utils = {}));

In our case we have over 100 classes which makes the output considerably larger.

Is there a solution to this?

@mhegazy
Copy link
Contributor

mhegazy commented Jun 15, 2017

duplicate of #447

@mhegazy mhegazy added the Duplicate An existing issue was already created label Jun 15, 2017
@mhegazy
Copy link
Contributor

mhegazy commented Aug 17, 2017

Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.

@mhegazy mhegazy closed this as completed Aug 17, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants