0

I am evaluating TypeScript for a project that my organization is developing. The application we're planning to build is a non-trivial one. I wanted to understand how I can compile the project if we use internal modules.

As far as I understand if we have an internal module's implementation spread across multiple files. All the files need to be compiled and then concatenated into one bundle to make it work.

So how do we work with a project which may have multiple of such internal modules. Has anybody here have any experience trying a similar approach?

2
  • Is there any reason that you want to use internal modules (now called "namespaces") instead of external modules (now simply called "modules")? Commented Mar 3, 2016 at 22:56
  • I find the idea on internal modules useful in creating bundles for the front-end of a web-application. Hence the interest. Commented Mar 4, 2016 at 17:55

1 Answer 1

1

So how do we work with a project which may have multiple of such internal modules. Has anybody here have any experience trying a similar approach

Having used TypeScript quite a lot I highly recommend against using internal modules. This is covered well here : https://github.com/TypeStrong/atom-typescript/blob/master/docs/out.md

Basically here is a summary from that page:

  • Runtime Errors
  • Fast compile
  • Global scope
  • Hard to analyze
  • Hard to scale
  • _references
  • Code reuse
  • Multiple Targets
  • Isolated Compile
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the answer. Its quite insightful. Given so many pitfalls, I just am wondering why they were added to the language in the first place. I was looking at the repository github.com/Microsoft/TouchDevelop. They have extensively used the idea of internal modules. But I was not clear about how they build the entire program.
Found another similar opinion - stevefenton.co.uk/2015/05/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.