HTML and CSS Reference
Introduction to TypeScript: Building
a Rogue-like Engine
Jesse Freeman, Developer Evangelist, Amazon
What Is TypeScript?
is cross-platform, runs on any browser, and is open source. Microsoft created it, and it's hands down one of the best
is that it allows you to start using some of the cool features of ECMAScript 6 (ES6) now, even though it may be years
away from being finalized. This means that you can put to good use classes and other higher-level constructs that you
find in languages such as C# and Java; moreover, TypeScript is incredibly similar to ActionScript 2 and 3. The final key
inject the code directly into your TypeScript classes and start taking advantage of typing provided by the compiler.
To help you better understand why TypeScript is so great, I have designed a rogue-like engine for you to build in this
chapter. Rogue engines are one of my favorite things to tinker with because their simplicity lends itself to some creative
ways to manipulate and visualize tile-based levels. In the example, I will walk you through setting up TypeScript, explain
some of the more complex concepts of the language, and show off how—with the help of typing—you can achieve
the language itself.
to picking up TypeScript, the learning curve is rather low. If you have a background in ActionScript, Java, or C#, you
will easily understand the more advanced language features quickly. If not, you will learn a lot from this chapter. At its
core, TypeScript is all about typing. There are three primitive types that you need to know:
var name: string = "Jesse Freeman";
As you can see, you simply use the string type for any strings.
var age: number = 34;