Skip to main content

Hidash

A Learning TypeScript > Generics 🥗 appetizer project.

Zap! Bang! Fizz!

Welcome, traveler, to the mystical world of... 2010! But it's not the 2010 you're thinking of. You've entered a parallel universe eerily similar to yours but for two key differences:

  • Lodash was never released
  • TypeScript was released much earlier, in the early 2000s

Your task is to create several Lodash-like useful array and object functions in TypeScript. They will need to use generic type arguments for proper typings.

Welcome to the TypeScript Zone.

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

Change your terminal directory to this project's:

shell
cd projects/generics/hidash
shell
cd projects/generics/hidash

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-unique --watch
shell
npm run tsc -- --project 01-unique --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

Steps

Notes

  • Don't import code from one step into another.
  • Each function you write will need to use generic type arguments to be properly typed.