-
Notifications
You must be signed in to change notification settings - Fork 60
Emit classes with private constructors. #229
Comments
This will generate incorrectly too. The problem seems to be handling private constructors incorrectly. Right now clutz treats the class entire as private when its constructor is marked as private. It should only make only the constructor private.
https://developers.google.com/closure/compiler/docs/js-for-compiler#tags Visibility on constructors will be released with TypeScript 2.0 So for now, the best solution would be just to ignore the private annotation on constructors |
This commit fixes the issue EDIT: Just noticed this commit does not update any of the units tests, I can update the tests if this is agreed solution to the problem |
I think the original bug report was different that the issue @lambertjamesd is bringing up. However, I cant repro the original issue, so lets continue on the private constructor issue (changing the issue title). There are three distinct TypeScript concepts that are overloaded in the symbol We agree that the constructor should be skipped (or emitted as private in future TS). It is definitely a bug that the namespace gets skipped because of the @Private annotation. The type is the tricky one, where I think closure does allow you to I think there is a way to fix the issue with the namespace, while still not emitting the constructor (nor type), by directly calling |
A namespace wont cut it. The following works in closure
Some other file
Not only can it be a type, but you can access all of its members as well. The only thing marking the constructor as private will do is disallow calling new on it I think the right approach is to simply ignore the annotation for constructors until TypeScript 2.0. |
That's a fair point, let's emit the constructor. I think in that case Can you add the |
Here is the pull request |
merged #300 |
e.g.
The text was updated successfully, but these errors were encountered: