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
interfaceW<X,Y,Z>{x: X;y: Y;z: Z;}functiontoModule<X,Y,Z>(){type$W=W<X,Y,Z>;return{W: $W// <-- wish could do that};}constm=toModule<string,number,boolean>();constw : m.W={// <-- wish could do thatx: '',y: 0,z: false};
both approach has issues with the current implementations that assumes an expression can only be a value, and not a namespace. we will need a proposal for this one.
I am afraid that alone returning a namespace isn't enough. It needs to be also passed as an argument and taken as a parameter. In order to declare it it has to have a type. Do namespaces have a type per se? Doubt so. Anyway, I believe that the difference between namespaces and objects is a made up. It would be great to see namepaces unified with objects because to JavaScript they are the same.
Activity
mhegazy commentedon Apr 26, 2016
so namespace expressions, a la class expressions?
zpdDG4gta8XKpMCd commentedon Apr 26, 2016
please allow either of the following:
mhegazy commentedon Apr 26, 2016
here is a sample:
mhegazy commentedon Apr 26, 2016
both approach has issues with the current implementations that assumes an expression can only be a value, and not a namespace. we will need a proposal for this one.
zpdDG4gta8XKpMCd commentedon Apr 26, 2016
Workaround
This is the workaround that I have to use now:
aluanhaddad commentedon Apr 26, 2016
👍
zpdDG4gta8XKpMCd commentedon Apr 26, 2016
Mohamed Hegazy (@mhegazy)
that would be super great
zpdDG4gta8XKpMCd commentedon Apr 28, 2016
I am afraid that alone returning a namespace isn't enough. It needs to be also passed as an argument and taken as a parameter. In order to declare it it has to have a type. Do namespaces have a type per se? Doubt so. Anyway, I believe that the difference between namespaces and objects is a made up. It would be great to see namepaces unified with objects because to JavaScript they are the same.
zpdDG4gta8XKpMCd commentedon Apr 28, 2016
closing in favor of #8358