This project is read-only.

Some Problems With Modules As They Stand Currently

Topics: General, Language Specification
Oct 4, 2012 at 3:57 PM
Edited Oct 4, 2012 at 3:58 PM
  1. You cannot export a function as a module.
  2. The "this" modifier is not typed inside the body of an exported function. It should be typed to the exports object.
  3. "exports" is not defined, but should be in the context of an external module. Some functions which are exported may be created with factories that need a reference to the original "this" which is not possible now (without tricking the compiler)
  4. "module" is not defined. Enabling this would fix the first issue raised as it's exports value could be assigned to a function. Regardless, it should be available...or "this" should reference the module object at root module level (ie outside the scope of any function, class, etc.)
  5. as far as I can tell, it's not possible to use the import construct to import an existing pure JS AMD module. That's a really common scenario. There should be a way to do that...and possibly to link that pre-existing js module to a TypeScript declaration source file somewhere.


Oct 4, 2012 at 5:21 PM

Thanks for the feedback.

The issue tracker is a better place for issues and would let us track the progress of each of those issues separately.