Final Project: Typed Task Tracker
Time to combine interfaces, generics, unions, and classes into one typed program.
Requirements
- Define an interface (or type) describing a
Task:id,title,done, andpriority: 'low' | 'medium' | 'high'. - 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 manageTaskobjects. - Write a function that filters tasks by priority and returns a properly typed result.
- Model an "add task" operation as a discriminated union or use an
enumsomewhere meaningful, e.g. a result type that can succeed or fail validation. - 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 createdAtfield 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! 🚀