Write a simple Angular app in TypeScript First, change the code in app.ts to:
Minimal project Let’s start out with a new directory. We’ll name it proj for now, but you can change it to whatever you want.
Discriminated Unions You can combine string literal types, union types, type guards, and type aliases to build an advanced pattern called discriminated
Block-scoped variable capturing When we first touched on the idea of variable capturing with var declaration, we briefly went into
Compiler Options Option Type Default Description --allowJs
User-Defined Type Guards Notice that we had to use type assertions several times. It would be much better if once we performed the check, we
Null and Undefined In TypeScript, both undefined and null actually have their own types named undefined
Install our build dependencies First ensure TypeScript and Typings are installed globally.
Write some code Let’s write our first TypeScript file using Knockout. First, create a new file in your src directory named hello
Block-scoping When a variable is declared using let, it uses what some call lexical-scoping or block-scoping
Page 24 of 29