Matt's Advanced TypeScript workshop

Overview

Advanced TypeScript Workshop

Hello! My name's Matt Pocock. This is a workshop repo to teach you about Advanced TypeScript.

Topics Covered

  • Using typeof and as const to derive types from runtime
  • Generics
  • Assertion functions & type predicates
  • Template literal types
  • Conditional types & infer
  • Diagnosing type errors

The plan of the workshop is to get you more confident with complex type signatures, less likely to want to use any, and faster at diagnosing errors.

Workshop Plan

We'll be running from 9AM PT - 2PM PT. Here's the plan:

  • 09:00-9:15: Setup & Housekeeping
  • 09:15-10:30: First session
  • 10:30-10:45: Coffee Break
  • 10:45-12:00: Second session
  • 12:00-12:30: Lunch
  • 12:30-14:00: Third session

We'll be working through the material in this repository, mostly in small groups.

System Requirements

  • git v2.14.1 or greater
  • NodeJS v16.15.0 or greater
  • npm v8.5.0 or greater

All of these must be available in your PATH. To verify things are set up properly, you can run this:

git --version
node --version
npm --version

Setup

After you've made sure to have the correct things (and versions) installed, you should be able to just run a few commands to get set up:

git clone https://github.com/mattpocock/advanced-typescript-workshop.git
cd advanced-typescript-workshop
npm install

That's it! You'll now have all the dependencies you need to work through the workshop exercises.

Exercises

Exercises are in the ./exercises folder. They're designed to be worked through one after the other.

Each exercise follows a similar pattern:

  • Look at the file with the *.code.ts extension. This gives you the code we're going to be working through and trying to understand.
  • Read through the *.exercise.ts file. Read through the file, comment-by-comment, and follow the instructions by either editing the file inline, or editing the *.code.ts file.
  • Wherever you see reference to Solution #1, check the *.solutions.ts file when you want to see the solution. Make sure you check the solution before proceeding! There's often crucial information there.

Be careful to read through each part of the exercise carefully - if you skip over parts of them, it might get difficult to find your way back.

Also, consider splitting your IDE into two panels, both looking at the same file. You can read from one, and write in the other - meaning you don't have to scroll up and down too much.

Emoji

Exercises use emoji to express various different things:

  • 💡 - A new idea appears!
  • 🛠 - Write some code!
  • 🧑‍💻 - Your team lead has some thoughts...
  • 🕵️‍♂️ - Time for an investigation...
  • ⛔️ - Eek! A type error.
  • - Hooray! The type error was fixed.
  • 🚁 - Hover over something.
  • 🔮 - Do a go-to-definition.

License

This material is available for private, non-commercial use under the GPL version 3.

You might also like...

Here are the sources for the wdi5 workshop at UI5con 2022.

wdi5 workshop at UI5con 2022 Here are the sources for the wdi5 workshop at UI5con 2022. prerequisites please have this installed on your 'puter: Node

Oct 19, 2022

REST API for a rudimentary blog - from Prisma Day 22 NestJS workshop

NestJS Workshop Prisma Day 22 - Let's build a REST API with NestJS and Prisma! Welcome to the code repository for the Prisma Day 2022 NestJS Workshop!

Jan 3, 2023

Remix enables you to build fantastic user experiences for the web and feel happy with the code that got you there. Get a jumpstart on Remix with this workshop.

💿 Remix Fundamentals Build Better websites with Remix Remix enables you to build fantastic user experiences for the web and feel happy with the code

Dec 25, 2022

Workshop for starknetCC (nextjs x starknetjs x cairo)

Workshop for starknetCC (nextjs x starknetjs x cairo)

NextJS - Starknet.js - Cairo • Workshop StarknetCC - Full dApp workshop by Alpha Road team You'll find the PDF presentation here Introduction This wor

Nov 8, 2022

Under the Sea is an official AWS workshop delivered by AWS SAs and AWS Partners to help customers and partners to learn about AIOps with serverless architectures on AWS.

Under the Sea - AIOps with Serverless Workshop Under the Sea is an exciting MMORPG developed by the famous entrepreneur behind Wild Rydes, the most po

Nov 16, 2022

Workshop: Crafting Human Friendly CLIs with Node.js Core

$ Crafting Human Friendly CLIs with Node.js Core █ A workshop by Simon Plenderleith & Kevin Cunningham. Getting ready for the workshop 1. Required sof

Dec 26, 2022

A long list of (advanced) JavaScript questions, and their explanations

A long list of (advanced) JavaScript questions, and their explanations

JavaScript Questions I post multiple choice JavaScript questions on my Instagram stories, which I'll also post here! Last updated: June 12th From basi

Jan 1, 2023

dotdotdot.js, advanced cross-browser ellipsis for multiple line content.

dotdotdot.js, advanced cross-browser ellipsis for multiple line content.

dotdotdot Dotdotdot is a javascript plugin for truncating multiple line content on a webpage. It uses an ellipsis to indicate that there is more text

Dec 20, 2022

lua-pack is an advanced lua bundler similar to webpack made for lua 5.1+ written in js

lua-pack is an advanced lua bundler similar to webpack made for lua 5.1+ written in js that makes working on large scale projects easy and fast. it takes all the files in your project and packs them into a single production ready file.

May 14, 2022
Owner
Matt Pocock
TypeScript wizard. Teaching TypeScript at https://totaltypescript.com
Matt Pocock
Remix enables you to build fantastic user experiences for the web and feel happy with the code that got you there. In this workshop, we'll look at some more advanced use cases when building Remix applications.

?? Advanced Remix Workshop Remix enables you to build fantastic user experiences for the web and feel happy with the code that got you there. In this

Frontend Masters 167 Dec 9, 2022
Advanced Next.js Masterclass: a workshop by Atila Fassina and Smashing Magazine

Setting up the system ?? Make sure you are running on Node.js 16 or newer. If properly installed, Node.js will exist in your $PATH. To check the versi

Atila Fassina 14 Nov 30, 2022
ITkonekt .NET workshop

Autobarn This is the sample application for Dylan Beattie's workshop on distributed systems with .NET. It's an Asp.NET Core web application based on v

Ursatile 1 Dec 19, 2021
Repository for hands on practice in Git and GitHub workshop

Git and Github Workshop Jan 2022 Successful contributors ✨ of this project will be featured on the GDSC website so as to bring attraction and learn vi

IIIT Vadodara Open Source 2 Feb 10, 2022
GatsbyConf - Decoupling Drupal Using Gatsby: A Crash Course workshop

GatsbyConf - Decoupling Drupal Using Gatsby: A Crash Course workshop

Octahedroid 7 Sep 29, 2022
Workshop contruyendo una API Rest con Node.js + Koa.js

Workshop contruyendo una API Rest con Node.js + Koa.js Tabla de Contenido Acerca de Introducción Explicación del caso de uso Ciclo de vida de las soli

Jhony Rivero 6 Apr 8, 2022
Portuguese version of the Cassandra driver javascript node.js workshop

Versão em Português do workshop Cassandra driver javascript node.js Olá e bem-vindo! Este é o repositório complementar para a apresentação prática dos

DataStax Developers 2 Mar 17, 2022
For this workshop, we're going to learn more about cloud computing by exploring how to use Pulumi to build, configure, and deploy a real-life, modern application using Docker

For this workshop, we're going to learn more about cloud computing by exploring how to use Pulumi to build, configure, and deploy a real-life, modern application using Docker. We will create a frontend, a backend, and a database to deploy the Pulumipus Boba Tea Shop. Along the way, we'll learn more about how Pulumi works.

Kat Cosgrove 9 Dec 29, 2022
A workshop about JavaScript iteration protocols: iterator, iterable, async iterator, async iterable

JavaScript Iteration protocol workshop A workshop about JavaScript iteration protocols: iterator, iterable, async iterator, async iterable by @loige.

Luciano Mammino 96 Dec 20, 2022
Resources for the App.js Conf Workshop 2022 hosted by Evan Bacon and Lydia Hallie

App.js Conf 2021 React Native workshop Order of sections: up-and-going: Learn about React Native and options to start your first project. get-started:

Evan Bacon 9 Sep 14, 2022