Hidash
A Learning TypeScript > Generics 🥗 appetizer project. You'll practice using generics to write data-agnostic utility functions.
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-projectscd learning-typescript-projectsnpm i
shell
git clone https://github.com/LearningTypeScript/projects learning-typescript-projectscd learning-typescript-projectsnpm i
Open your editor in this project's directory:
shell
code projects/generics/hidash
shell
code 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
Note: your terminal should be in the
hidash
directory, not the root repository's directory.
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.