Skip to content

Bad output #111

@altano

Description

@altano

TypeScript outputs AMD that looks like this:

define("SomeModule", ["require", "exports"], function(n, t) {
    var i, r, u;
    (function(n) {
        n[n.Unknown = 0] = "Unknown";
    })(t.ContextHostType || (t.ContextHostType = {}));
});

I don't know why it takes require itself as a dependency, but it should work.

AMDClean is pretending that dependency doesn't exist though and providing bad output:

;(function() {
var SomeModule = {};
SomeModule = function (n, t) {
  var i, r, u;
  (function (n) {
    n[n.Unknown = 0] = 'Unknown';
  }(t.ContextHostType || (t.ContextHostType = {})));
}(SomeModule);
}());

This blows up on t.ContextHostType, because n is the empty object that represents the exports, not t. I guess the right output would be to have the function take only one parameter?

You can see it here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions