TypeScript Course
This course aims to teach you TypeScript. From the very basics, including JavaScript fundamentals toadvanced topics. Every topics comes with exercises, so that what you learn sticks.
Afterwards you should be able to safely type even the most exotic JavaScript constructs in your API or
front-end framework code. Instructor-led course with hands-on exercises for every topic.
Prerequisites:
At least 6 months programming experience
Knowledge of JavaScript is a plus
Rick Beerendonk - instructor of the course
Rick is a senior consultant and trainer from The Netherlands.
He has over 25 years of professional experience while working in small, large and fast growing organisations.
His passion is simplicity, wellwritten code and team dynamics.
He is specialised in front-end technologies and speaks regularly about these topics at international events.
Agenda:
Introduction
- History
- Why TypeScript?
- The TypeScript Compiler (tsc)
- Setting up and running the compiler
- Compiler strictness: strict mode, noImplicitAny, strictNullChecks
- Configuration file (tsconfig.json) overview
- Runtime vs Compile-time type checking
- Type inference
- Automatic type assignment
- Best practices
2. Basic Use
- Basic Types
- Overview of JS types: number, string, boolean, null, undefined
- Additional TypeScript types: any, unknown, void, never
- Arrays: number[], Array<number>, multidimensional arrays
- null vs undefined
- Literals: string, numeric, and boolean literal types
- Type Annotations
- Variables and constants
- Function parameters and return types
- Object type annotations
- Combining types using Union (|) and Intersection (&)
- Type Assertions
- as syntax
- Non-null assertion operator (!)
- Loops, Iterators and Generators
3. TypeScript-Only Types
- Enums
- Numeric and string enums
- Heterogeneous enums
- Tuples
- Fixed-length arrays with known types
- Tuple destructuring
- Optional tuple elements and spread in tuples
4. Working with Functions
- Function Types
- Explicitly typing function arguments and return values
- Arrow function syntax
- Special Cases
- void vs never types
- Optional and default parameters
- Rest parameters
- Overloading functions
- Destructuring with Type Annotations
- Function parameter destructuring
- Nested destructuring
- Exclamation Mark
- The ! operator for definite assignment
5. Working with Classes
- Class Basics
- Defining classes, constructors, and methods
- Using readonly and static modifiers
- Access Modifiers
- public, private, and protected
- Constructor parameter properties
- Advanced Features
- Abstract classes and methods
- Encapsulating member variables
- Using instanceof for type checking
- Conditional types (A extends B ? C : D)
6. Types and Interfaces
- Defining Types
- Basic types, union types, and intersection types
- Recursive types
- Type Guards
- typeof, instanceof, and custom type guards
- Nullable Types
- Handling null and undefined
- Type Aliases
- When and why to use type aliases
- Mapped Types
- Creating new types from existing ones
- Interfaces
- Defining array, function, and class types
- Extending interfaces
- Type vs Interface
- Key differences and when to use each
7. Utility Types
- Overview of built-in utility types:
- Partial
- Required
- Pick
- Omit
- Record
- Readonly
- Exclude and Extract
- NonNullable
- ReturnType
- InstanceType
- Custom Utility Types
- Creating and using custom utility types
8. Generics
- Introduction to Generics
- Writing generic functions
- Generics in interfaces and classes
- Generic Constraints
- Extending types with constraints (T extends U)
- Practical Applications
- Generic utility functions
- Generic React components
9. Modules & Namespaces
- Modules: Import, Export
- Namespaces
- Modules vs Namespaces
10. Declaration Files
- Writing .d.ts files
- Using third-party declaration files
- Publishing a library with TypeScript
11. Advanced Topics
- Type guards
- infer
- as const
- Create types using template literals
- Advanced types
- Doʼs and Donʼts
- Best practices and common pitfalls
- Whatʼs New in TypeScript
- Latest features in the most recent version
12. Front-end frameworks (optional)
Use TypeScript in React, Angular, Vue, Svelte, etc.
Bonus: Modern JavaScript Features
- Destructuring
- Arrays and objects
- Default values
- Nested destructuring
- Promises
- Promise.all, Promise.any, Promise.race, Promise.finally, and
- Promise.allSettled
- Exception Handling
- Advanced Concepts
- Async/await with TypeScript
- Error handling in async workflows
- WebWorkers