Training program
Introduction to TypeScript
- What is TypeScript?
- Basics of configuring a TypeScript project:
- Installing TypeScript using npm
- Creating and configuring the `tsconfig.json` file (e.g., `strict`, `noImplicitAny`, `target`, `module`)
- Overview of TypeScript-to-JavaScript compilation and source maps
- TypeScript vs JavaScript
Type System in TypeScript
- Basic data types and their proper usage
- Complex types:
- Arrays, tuples, and enums
- Function types: describing function signatures, function overloading, `this` in functions, and arrow functions
- Objects and interfaces:
- How to define and use interfaces (`interface`) and types (`type`) to describe data structures
- Differences between `interface` and `type` — when to use which
- `readonly` and `const` — creating immutable objects
- Generics (generic types)
- Advanced types:
- Union Types and Intersection Types
- Conditional Types
Type Inference
- How TypeScript infers types
- Type Narrowing
- Control flow analysis and advanced narrowing constructs
Designing Types
- Creating readable and type-safe type definitions
- Modularization and reusability of types
- Interfaces and relationships between types
Object-Oriented Programming in TypeScript
- Defining classes and inheritance:
- Class fundamentals in TypeScript
- How TypeScript supports inheritance, polymorphism, and encapsulation
- Abstractions and interfaces:
- When to use abstract classes vs interfaces
- Examples of more advanced interface usage in object-oriented code
- Access modifiers:
- Controlling access to fields and methods with `public`, `protected`, and `private`
- Using `readonly` in classes to ensure immutability
Best Practices
- Safe error handling in TypeScript:
- How to write type-safe `try-catch` blocks
- Typing exceptions and creating precise error messages
- Asynchronous programming:
- Using types in async/await workflows
- Working with Promises and leveraging type safety in asynchronous operations
- Testing in TypeScript
- Typing external libraries