Book Image

Learning TypeScript

By : Remo H. Jansen
Book Image

Learning TypeScript

By: Remo H. Jansen

Overview of this book

<p>TypeScript is an open source and cross-platform typed superset of JavaScript that compiles to plain JavaScript that runs in any browser or any host. It allows developers to use the future versions of JavaScript (ECMAScript 6 and 7) today. TypeScript adds optional static types, classes, and modules to JavaScript, to enable great tooling and better structuring of large JavaScript applications.</p> <p>This book is a step-by-step guide that will get you started with TypeScript with the help of practical examples. You start off by understanding the basics of TypeScript. Next, automation tools like Grunt are explained followed by a detailed description of function, generics, callbacks and promises. After this, object-oriented features and the memory management functionality of TypeScript are explained. At the end of this book, you will have learned enough to implement all the concepts and build a single page application from scratch.</p>
Table of Contents (18 chapters)
Learning TypeScript
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 5. Runtime

After completing this book, you will probably be eager to start a new project to put into practice all your new knowledge. As the new project grows and you develop more complex features, you might encounter some runtime issues.

We should be able to resolve design-time issues with ease because in the previous chapter, we looked at the main TypeScript features.

However, we have not learned much about the TypeScript runtime. The good news is that, depending on your background, you may already know a lot about it, as the TypeScript runtime is the JavaScript runtime. TypeScript is only used at design time; the TypeScript code is then compiled into JavaScript and finally executed. The JavaScript runtime is in charge of the execution. Is important to understand that we never execute TypeScript code and we always execute JavaScript code. For this reason, when we refer to the TypeScript runtime, we will, in fact, be talking about the JavaScript runtime.

When we compile our TypeScript...