Skip to main content

Array Type Shenanigans

A Learning TypeScript > Type Operations 🥗 appetizer project.

Hi! This is Josh, author of Learning TypeScript. Congrats on making it all the way through the book to the final chapter! Type operations are a ton of fun to play around with once you get the hang of them.

These appetizer projects showcase a bunch of my favorite cool things you can do using array and/or tuple types with conditional types. Each gives a small into to the new thing because it can be tricky to find out the ways you can or cannot combine type operations. There's no silly theme, to help not distract from learning those new things.

I hope you're enjoying the book and these projects! 💖


If you haven't yet, set up the repository locally.

git clone learning-typescript-projects
cd learning-typescript-projects
npm i

Change your terminal directory to this project's:

cd projects/type-operations/array-type-shenanigans

Start the TypeScript compiler in watch mode:

tsc --watch



  • Don't import code from one step into another.
  • You'll be working entirely in the type system. There will be no runtime code. 🤘