Typescript analysis doesn't understand "exports =" statement?
e.g.
var m = {
// functions, etc.
};
exports = m;
With Resharpe installed, the declaration of m is displayed in grey, as if it is unused.
But the statement "exports = m;" is valid TypeScript meaning that the object m should be the public interface of this module, equivalent to:
module.exports = m;
Please sign in to leave a comment.
Hi, Daniel.
Isn't it "export =" instead of "exports ="?
http://www.typescriptlang.org/Content/TypeScript%20Language%20Specification.pdf#page=132&zoom=auto,69,126
If not, could you please provide a full example?
Thank you!
To reproduce it, create a project with VS2013's 'HTML Application with TypeScript' template.
Add this to the bottom of the app.ts file:
The m in the first line is grayed. Hover over the m and it says "Local variable 'm' is never used".
My previous description was incorrect as you say - I use CommonJS most of the time, where "exports" is used!
Daniel,
Thank you very much for making things clear.
I thought that it was about unresolved keyword, but it's about control flow inspection, I see now.
I've created a bug:
http://youtrack.jetbrains.com/issue/RSRP-414568
Control flow analysis now doesn't take into account several TS-specific constructs, yes. That will be fixed in 9.0.