Skip to content

foundersandcoders/typescript-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypeScript challenge

Practice using various TypeScript features to write more robust code.

Setup

Make sure you have Git and Node (v20) installed.

  1. Use this template, clone your copy, cd into it
  2. Run npm install to install all the dependencies
  3. Run npm run build to run the TS compiler and check for errors

Challenge 1

Open src/1.ts in your editor. Add type annotations to the functions so that there are no longer any type errors.

Challenge 2

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.

Challenge 3

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.