Practice using various TypeScript features to write more robust code.
Make sure you have Git and Node (v20) installed.
- Use this template, clone your copy, cd into it
- Run
npm install
to install all the dependencies - Run
npm run build
to run the TS compiler and check for errors
Open src/1.ts
in your editor. Add type annotations to the functions so that there are no longer any type errors.
Open src/2.ts
in your editor. There are several types defined for various shapes. Complete the area
function so that it correctly returns the area for each different shape.
Open src/3.ts
in your editor. You should see a comment with some example Pokémon data. Complete the findByType
function. It should receive two parameters: an array of Pokémon objects like the example, and a type to filter for. It should return any Pokémon with a matching type.