TypeScript Tutorial
TypeScript Projects
Ten complete TypeScript programs: a calculator, a student list, a library catalog, and a shopping cart.
What a project is on StudyGrid
A TypeScript lesson shows one idea: an array, a class, a Map. A project puts several of them in one compiling program. Each page here walks from a small slice to a complete TypeScript program you can run. The chapter list follows the C++ projects so you can compare a typed class in TypeScript with the same idea in C++.
Click Try it in TypeScript under an example. That opens /typescript/try. tsc runs in the browser. Programs use hardcoded demo data so they run without extra stdin. After you understand the logic, wire in readLine() if you want typed input.
10 build-along projects. Each page walks through the design, then a working program you can open inTry TypeScript at /typescript/try. Change a value, run it again, then try the practice tasks at the bottom.
The 10 projects
Calculator
A four-function calculator with functions per operator and a check for divide-by-zero.
functions · if · numberBeginnerStudent Manager
Store students in a typed array, print the roster, and find the top score.
interface · array · loopIntermediateBank System
An Account class with deposit, withdraw, and a printed statement. Balance never goes negative.
class · methods · privateBeginnerQuiz Game
A scored quiz from an array of questions. Print each prompt, check the answer, and tally.
array · interface · scoreIntermediateLibrary Catalog
A catalog of books with title, author, and year. Search by author and list every match.
array · filter · stringBeginnerTemperature Converter
Convert Celsius, Fahrenheit, and Kelvin with a small set of functions and formatted output.
functions · number · toFixedIntermediateTic-Tac-Toe
A 3x3 board as a string array. Place marks, print the grid, and detect a winner.
array · loops · functionsIntermediateContact Book
Store contacts in a Map from name to number, then add, find, and list them.
Map · string · iterateBeginnerGrade Calculator
Convert numeric scores to letter grades, compute an average, and print a report.
array · functions · averageIntermediateShopping Cart
A cart of line items with name, quantity, and price. Print a receipt and the grand total.
interface · array · moneyHow to work a project
- Read the goal and the TypeScript skills listed on the page.
- Compile the first small example at
/typescript/try. - Build up to the complete program.
- Change one value and compile again.
- Finish the practice tasks before the next project.