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
Exporting a keyword-named function in a module #1784
This isn't allowed at the moment because JavaScript doesn't allow that pattern either. Presumably Q has actually defined it as something like module.exports.try = function() {}. We could start allowing you to use keywords for export var names to support this.
In the meantime one workaround would be to use a merged class and module.
Activity
mikaturunen commentedon Jan 23, 2015
👍
I need this information also.
danquirk commentedon Jan 23, 2015
This isn't allowed at the moment because JavaScript doesn't allow that pattern either. Presumably Q has actually defined it as something like
module.exports.try = function() {}. We could start allowing you to use keywords forexport varnames to support this.In the meantime one workaround would be to use a merged class and module.
The downside here is that now the type system will think Q has a construct signature and a prototype property.
adamvoss commentedon Nov 5, 2016
I also encountered this or a variation thereof.
I was trying to do a literal port of the following JavaScript,
but, could not use the following TypeScript
In the end I found the JavaScript version still works in the TypeScript file and had to stick with that for this function.
DanielRosenwasser commentedon Nov 6, 2016
Related is #9846. If I recall, we decided that it was too complex because you can rewrite your module as follows:
aluanhaddad commentedon Nov 6, 2016
@vossad01, Daniel Rosenwasser (@DanielRosenwasser) I'm curious why not use this instead.turns out this errors on import, sigh...