TypeScript is a superset of JavaScript that adds static types and other language features, then compiles into JavaScript that browsers can execute. Its type annotations make JavaScript development more predictable and familiar to developers from languages such as C# or Java. section 3.4 section 3.5
Angular applications use TypeScript as their primary language. The treatment focuses on the basic features needed for Angular development rather than offering a comprehensive language reference, continuing with more advanced features later. section 1.15 section 3.4
Core ideas include:
- TypeScript specifies expected data types without changing JavaScript’s underlying type system. section 3.5
- The compiler removes TypeScript features and produces browser-executable JavaScript. section 2.3.1
- Modules organize dependencies between files through imports and exports. section 2.3.1
- Classes and constructors support application data models, while Angular’s build process can translate newer JavaScript features for older browsers. section 2.3.1
A small TypeScript data model
A to-do application models an item with a string task and a Boolean completion state. A TodoList imports TodoItem, stores an array of items, exposes them as read-only, and adds new tasks by constructing TodoItem instances. section 2.3.1
Listing 2.7. The contents of the todoItem.ts file in the src/app folder
export class TodoItem {
constructor(public task: string, public complete: boolean = false) {
// no statements required
}
}
View the complete TodoItem implementation, including its typed task and default completion value. section 2.3.1



