Skip to main content

Classifying Creatures

A Learning TypeScript > Classes 🥗 appetizer project. You'll practice writing classes with TypeScript type annotations to describe members.

G'day, mate! I'm here with the veterinarian center and a wonderful selection of great pets! We've got a parrot, some gerbils and hamsters - and wow, a whole litter of puppies! Crikey!

Thing is, we're just a tad bit overloaded with all the animals here. We've got to get a system to categorize them. Can you please help us classify our creatures?

Setup

If you haven't yet, set up the github.com/LearningTypeScript/projects repository locally.

shell
git clone https://github.com/LearningTypeScript/projects learning-typescript-projects
cd learning-typescript-projects
npm i
shell
git clone https://github.com/LearningTypeScript/projects learning-typescript-projects
cd learning-typescript-projects
npm i

Open your editor in this project's directory:

shell
code projects/classes/classifying-creatures
shell
code projects/classes/classifying-creatures

In one terminal, run the TypeScript compiler via the tsc script within whichever step you're working on. For example, to start the TypeScript compiler on the first step in watch mode:

shell
npm run tsc -- --project 01-polly-parrots-properties --watch
shell
npm run tsc -- --project 01-polly-parrots-properties --watch

In another terminal, run Jest via the test script on whichever step you're working on. For example, to start tests for the first step in watch mode:

shell
npm run test -- 1 --watch
shell
npm run test -- 1 --watch

Note: your terminal should be in the classifying-creatures directory, not the root repository's directory.

Steps

Notes

  • Don't import code from one step into another.