As we already know, when we compile our TypeScript code, the compiler will generate a JavaScript file for each existing TypeScript file. If we run the application in a web browser, these files won't be really useful on their own because the only way to use them would be to create an individual HTML script tag for each one of them.

However, this would be highly inconvenient and inefficient because each script tag will translate into a round trip between the web browser and the server serving the JavaScript files. Using script tags is also slower than using Ajax calls because script tags can prevent the browser from rendering.

Please note that in a modern web browser, we can make some of the script tags asynchronous but it is not always ...

Get Learning TypeScript 2.x - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.