You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Suggestion: Only create global variable for module if something tangible is exported #8668
I think it would be great if when creating a module it would only create a global variable for that module if something tangible is exported. Whenever I use Typescript with angular I have no need for the global variable.
Nothing tangible is exported here so there is no need to create a global variable of "a".
The nice thing is I can still use the interfaces at design time because of the module and interface. But at runtime there is no need for the javascript variable to exist as it will just be an empty object anyway.
Discussed; this would complicate the emitter quite a bit and in the majority of cases there's going to be a global anyway. Workaround of using an IIFE seems acceptable now that local types are supported. #206 is related so if we get more use cases like this we can reconsider that one.
Ryan Cavanaugh (@RyanCavanaugh) Well at this point there is no need to make both a module and an IIFE. I might as well just use the module that is being created empty anyway as in the above comment. There would not be any benefit to your example over mine above that I can tell.
Activity
RyanCavanaugh commentedon Jun 9, 2016
Discussed; this would complicate the emitter quite a bit and in the majority of cases there's going to be a global anyway. Workaround of using an IIFE seems acceptable now that local types are supported. #206 is related so if we get more use cases like this we can reconsider that one.
zolem commentedon Jun 10, 2016
Ryan Cavanaugh (@RyanCavanaugh) so can I still access the local classes/interfaces outside of an IIFE? With angular you still need the type hinting.
RyanCavanaugh commentedon Jun 10, 2016
You'd write e.g.:
zolem commentedon Jun 13, 2016
Ryan Cavanaugh (@RyanCavanaugh) Well at this point there is no need to make both a module and an IIFE. I might as well just use the module that is being created empty anyway as in the above comment. There would not be any benefit to your example over mine above that I can tell.