Looking at this TypeScript code:

```
class Greeter {
    greet() {}
}

```

It generates an IIFE (Immediately-Invoked Function Expression) around the constructor function and all prototype function declarations like:

```
var Greeter = (function () {
    function Greeter() {
    }
    Greeter.prototype.greet = function () { };
    return Greeter;
}());

```

What is the advantage here? When ever I read about IIFE I see a lot usage in defining modules. As far as I can see Typescript does not generate anything inside the IIFE that would pollute the global namespace.

In my opinion there is no advantage over this class declaration:

```
var Greeter = function () {}
Greeter.prototype.greet = function () { };

```

**What is the reason for it?**