Book Image

TypeScript Essentials

By : Christopher Nance
Book Image

TypeScript Essentials

By: Christopher Nance

Overview of this book

Table of Contents (15 chapters)

Converting to AMD modules


Converting to AMD modules is a fairly simple process. However, this is a good time to look at the structure and maintainability of our project. Before getting started, we must install the RequireJS NuGet package Version 2.1.14 and the corresponding declaration file requirejs.TypeScript.DefinitelyTyped Version 0.2.0.

The TypeScript build settings must also be changed to use the AMD module system as shown in the previous chapter. Once these steps are completed, we can begin enhancing our application. To do this, we will want to add a folder structure to our application that will help us easily separate modules based on functionality. At this point, it is important to decide how you want to divide up the code for your application. Since we are using RequireJS modules, we will be using the export keyword for all objects that we want to use from other modules. There are three ways to use the export keyword, and each one has different ramifications on the resulting JavaScript...