Workshop repository:
https://github.com/moonhighway/generic-functions-in-typescript-workshop
Required: Node.js >= v18.0.0
Recommended: Visual Studio Code (with GitHub Copilot disabled)
Setup:
If you've already cloned the repository, bring it up-to-date:
git pull
Then install dependencies by running:
npm install
Things which are generic.
Functions function someFunction(){...}
Classes class SomeClass(){...}
Types type SomeType = {...}
Functions function someFunction<Type>(){...}
Classes class SomeClass()<Type>{...}
Types type SomeType<Type> = {...}
Adding a type parameter makes the "thing" generic! ✨