Personal · TypeScript practice · 2025Learning project
Task manager CLI
A command-line task manager (add, list, start, complete, delete) where a task is a discriminated union: To do, In progress or Done. Only an in-progress task has a start time and only a done task has a completion time, so the compiler rejects code that reads either too early.
Who wrote whatBuilt while learning TypeScript with an AI tutor; some code comments still speak to me (“like your Circle/Square/Rectangle example”). The repo's README was written by GitHub Copilot's coding agent.
How it's organised
- index.ts: the commands, parsed with commander, which print results and nothing else.
- task-service.ts: the rules, such as “only a to-do task can be started”.
- repository.ts: a generic Repository<T> that reads and writes a JSON file and knows nothing about tasks.
- types.ts and task-utils.ts: the task union, a priority enum, and type guards like isTodoTask that the service uses to narrow safely.
What I learned
Model states as types and a whole class of “field is undefined” bugs can't be written at all. Keep storage generic and the rules in one place.
Screenshots to come.
NextRide app (early build)→