Learning TypeScript
A friendly next step after JavaScript that introduces type checking, typed variables, functions, arrays, objects, unions, and a typed task planner.
Learning TypeScript
Welcome to Learning TypeScript.
This project is a friendly next step after basic JavaScript. TypeScript is JavaScript with extra type checking, which helps you catch mistakes earlier.
Each module has two main files:
README.md: the lesson instructionsindex.ts: the TypeScript file you will run and edit
The best way to learn is simple:
- Open the module folder.
- Read the
README.md. - Open
index.ts. - Run the code.
- Change something small.
- Run it again and notice what changed.
Table of Contents
- What you will learn
- How to use this course
- How to run a module
- Modules overview
- Final project
- Tips for learning
- Wrap up
What you will learn
By the end of this course, you will have practiced:
- how to run your first TypeScript program
- how to add simple types to variables
- how to write functions with typed parameters and returns
- how to describe groups of values and object shapes
- how to handle values that can have more than one type
- how to build a small typed task planner
- building a small final project
You will not know every part of TypeScript yet, and that is completely fine.
How to use this course
Start with Module 1 and go in order. Each module adds one small TypeScript idea to JavaScript you may already recognize.
How to run a module
Open the terminal from the learning-typescript folder.
Then run a module like this:
tsx 01_welcome_to_typescript/index.ts
For another module, change the folder name.
Modules overview
Module 1: Welcome to TypeScript
You will run your first TypeScript program.
This module keeps the examples small so the types are easy to see.
Module 2: Types and Annotations
You will add simple types to variables.
This module keeps the examples small so the types are easy to see.
Module 3: Functions with Types
You will write functions with typed parameters and returns.
This module keeps the examples small so the types are easy to see.
Module 4: Arrays and Objects
You will describe groups of values and object shapes.
This module keeps the examples small so the types are easy to see.
Module 5: Unions and Narrowing
You will handle values that can have more than one type.
This module keeps the examples small so the types are easy to see.
Final Project: Task Planner
You will build a small typed task planner.
This module keeps the examples small so the types are easy to see.
Final project
Final Project: Task Planner
At the end of the course, you will build a small typed task planner. It uses typed objects, arrays, functions, and a union type for task status.
Tips for learning
Run the code often. Change one type or one value at a time. If TypeScript complains, read the message slowly. It is trying to point you toward a mismatch.
Wrap up
TypeScript helps you describe what your JavaScript values should look like. That makes larger programs easier to change with confidence.