TypeScript from JavaScript

Lesson 6 of 6

Final Project: Typed Task Tracker

Time to combine interfaces, generics, unions, and classes into one typed program.

Requirements

  1. Define an interface (or type) describing a Task: id, title, done, and priority: 'low' | 'medium' | 'high'.
  2. Write a generic Store<T> class (or a set of typed functions) that can add, remove, and list items of any type, then use it to manage Task objects.
  3. Write a function that filters tasks by priority and returns a properly typed result.
  4. Model an "add task" operation as a discriminated union or use an enum somewhere meaningful, e.g. a result type that can succeed or fail validation.
  5. Make sure the whole file compiles with no implicit anys, add explicit types anywhere inference doesn't cover you.

Stretch goals

  • Sort tasks by priority.
  • Add a readonly createdAt field set in the constructor.
  • Split your types into a separate file and import them with import/export.

Submit your repository link below when you are done, an instructor will review it before you can mark this lesson complete. Good luck! 🚀

This lesson ends in a project. Build it on your own machine, there's nowhere to submit it here, but the brief above is everything you need.