- Overview
- Prerequisites
- Audience
- Curriculum
Description:
This half-day TypeScript training provides a focused introduction to TypeScript, a typed superset of JavaScript that adds optional static types and powerful tooling for large-scale applications. Participants will learn how to integrate TypeScript into their JavaScript projects, understand its core features like type annotations, interfaces, and classes, and discover how TypeScript can prevent common JavaScript errors. The training includes practical coding exercises to help participants understand TypeScript syntax and best practices.
By the end of this training, participants will be equipped with the knowledge to write clean, maintainable, and type-safe code using TypeScript.
Duration: Half Day
Course Code: BDT379
Learning Objectives:
After completing this course, participants will be able to:
- Understand the advantages of using TypeScript over JavaScript
- Set up a TypeScript environment and compile TypeScript code
- Use basic and advanced TypeScript features like types, interfaces, and classes
- Integrate TypeScript into existing JavaScript projects
- Identify and fix type-related errors during development
- Leverage TypeScript to enhance code readability and maintainability
- Basic understanding of JavaScript
- Familiarity with web development concepts (HTML, CSS, JavaScript)
This course is designed for JavaScript developers, front-end and back-end developers, and anyone interested in improving code quality and efficiency using TypeScript. It is suitable for developers aiming to transition from JavaScript to TypeScript or those looking to adopt strong typing in their projects.
Course Outline:
Module 1: Introduction to TypeScript
- What is TypeScript?
- Why use TypeScript? Advantages over JavaScript
- Evolution from JavaScript to TypeScript
- Setting Up TypeScript Environment
- Installing TypeScript
- TypeScript Configuration (tsconfig.json)
- Compiling TypeScript into JavaScript
- TypeScript in Action
- Running TypeScript code in the browser and Node.js
Hands-On:
- Setting up TypeScript and writing your first TypeScript program
- Compiling and running TypeScript code
Module 2: Type Annotations and Basic Types
- Type Annotations in TypeScript
- Adding types to variables, functions, and parameters
- Basic types: string, number, boolean, array, tuple, enum
- Union and Intersection Types
- Working with multiple types using unions
- Creating complex types using intersections
- Type Inference
- Understanding how TypeScript infers types automatically
- When to explicitly annotate types
Hands-On:
- Writing functions with type annotations
- Exploring how TypeScript infers types in different situations
- Using union and intersection types in TypeScript
Module 3: Advanced Types and Interfaces
Interfaces in TypeScript
- Defining interfaces and their use cases
- Implementing interfaces with classes and objects
- Optional, Readonly, and Index Signatures
- Making object properties optional and immutable
- Defining dynamic object types using index signatures
- Type Aliases
- Creating reusable type definitions with type aliases
Module 4: Classes and Object-Oriented TypeScript
Classes in TypeScript
- Defining classes and constructors
- Working with access modifiers (public, private, protected)
- Inheritance and Polymorphism
- Extending classes and method overriding
- Implementing interfaces in classes
- Static Methods and Properties
- Understanding and using static members in TypeScript classes
Hands-On:
- Building classes and using inheritance to share functionality
- Creating and using static methods
Module 5: Integrating TypeScript with JavaScript Projects
- Migrating JavaScript to TypeScript
- Gradual migration strategies
- Managing third-party JavaScript libraries with TypeScript
- Type Declaration Files
- Using DefinitelyTyped and declaration files (.d.ts) for JavaScript libraries
- Writing custom type declarations
Hands-On:
- Converting a small JavaScript project to TypeScript
- Using third-party JavaScript libraries in a TypeScript project
Training Material Provided:
- Course slides and reference materials
- TypeScript code samples for each module
- Access to TypeScript documentation and external resources