We use cookies to enhance your experience on the site
CodeWorlds
Back to collections
Guide17 min read

Visual Types - Interactive TypeScript lessons by Kit Langton

Visual Types is an interactive TypeScript type system course with visualizations. Learn generics, conditional types, mapped types and infer through animations and browser exercises.

Visual Types - Interaktywne lekcje TypeScript z wizualizacjami

Czy kiedykolwiek patrzyłeś na skomplikowany typ TypeScript i czułeś, że czytasz hieroglify? Omit<Pick<T, K extends keyof T>, "id"> - co to właściwie robi? Jak przepływają dane przez conditional types? Czym różni się extends w generics od extends w interfejsach?

Visual Types to projekt Kit Langtona, który rozwiązuje ten problem w najbardziej elegancki możliwy sposób - pokazuje ci jak typy TypeScript działają przez interaktywne wizualizacje i animacje. Zamiast czytać suche definicje, obserwujesz w czasie rzeczywistym jak system typów przetwarza twój kod.

Czym jest Visual Types?

Visual Types (dostępny na types.kitlangton.com) to zbiór interaktywnych lekcji poświęconych systemowi typów TypeScript. Każda lekcja łączy wizualne animacje z wyjaśnieniami, pozwalając zobaczyć - dosłownie - jak TypeScript rozwiązuje typy, przeprowadza inferencję i stosuje transformacje.

Projekt stworzył Kit Langton - programista znany z pracy z systemami efektów (Effect, Scala ZIO) oraz tworzenia interaktywnych narzędzi edukacyjnych. Visual Types jest częścią jego większej filozofii: najlepszym sposobem na naukę abstrakcyjnych konceptów programistycznych jest ich wizualizacja.

Dlaczego wizualizacja typów ma znaczenie?

System typów TypeScript jest jednym z najbardziej ekspresyjnych wśród popularnych języków programowania. Ale ta ekspresyjność ma swoją cenę - złożoność. Gdy zaczynasz pracować z:

  • Generics - typy parametryczne, które przyjmują inne typy jako argumenty
  • Conditional types - T extends U ? X : Y - logika warunkowa na poziomie typów
  • Mapped types - transformacje kluczy i wartości obiektów
  • Template literal types - manipulacja stringów na poziomie typów
  • Infer - ekstrakcja typów z wzorców

...tradycyjne podejście (czytanie dokumentacji) szybko staje się niewystarczające. Potrzebujesz zobaczyć jak te mechanizmy działają krok po kroku.

Jak działają lekcje?

Interaktywne wizualizacje

Każda lekcja w Visual Types to nie statyczny tekst z kodem. To interaktywna animacja, która:

  1. Pokazuje przepływ typów - widzisz jak TypeScript rozwiązuje typ krok po kroku
  2. Wizualizuje transformacje - obserwujesz jak mapped types transformują obiekt
  3. Animuje inferencję - patrzysz jak infer wyciąga typy z wzorców
  4. Pozwala eksperymentować - możesz modyfikować parametry i obserwować wyniki

Narracja i kontekst

Lekcje nie rzucają cię na głęboką wodę. Każda koncepcja jest wprowadzana stopniowo, z wyjaśnieniami w naturalnym języku, zanim przejdziesz do wizualizacji. To podejście sprawia, że nawet zaawansowane tematy jak recursive conditional types stają się zrozumiałe.

Kluczowe tematy

Podstawy systemu typów

Visual Types zaczyna od fundamentów - jak TypeScript rozumie typy, czym jest type narrowing, jak działa structural typing. Te podstawy są kluczowe, bo na nich budowane są wszystkie zaawansowane koncepty.

Code
TypeScript
type IsString<T> = T extends string ? true : false

type A = IsString<"hello">  // true
type B = IsString<42>        // false

Zamiast zgadywać co extends robi w kontekście typów, Visual Types pokazuje wizualnie jak TypeScript porównuje typ "hello" z string i dlaczego wynik to true.

Generics

Generics to jeden z najważniejszych konceptów w TypeScript. Visual Types wizualizuje je jako "sloty" do których wkładasz konkretne typy:

Code
TypeScript
type Box<T> = {
  value: T
  isEmpty: boolean
}

type StringBox = Box<string>
// { value: string; isEmpty: boolean }

type NumberBox = Box<number>
// { value: number; isEmpty: boolean }

Wizualizacja pokazuje jak T jest zastępowane konkretnym typem w każdym miejscu gdzie się pojawia - nie jako abstrakcyjna zamiana, ale jako animowany przepływ.

Conditional types

Conditional types to potężne narzędzie, ale ich zagnieżdżanie potrafi być trudne do śledzenia:

Code
TypeScript
type TypeName<T> =
  T extends string ? "string" :
  T extends number ? "number" :
  T extends boolean ? "boolean" :
  T extends undefined ? "undefined" :
  "object"

type T0 = TypeName<string>   // "string"
type T1 = TypeName<boolean>  // "boolean"
type T2 = TypeName<Date>     // "object"

Visual Types pokazuje ścieżkę ewaluacji - który branch jest wybierany i dlaczego, z podświetleniem aktywnej gałęzi.

Mapped types

Mapped types pozwalają transformować kształt obiektów:

Code
TypeScript
type Readonly<T> = {
  readonly [K in keyof T]: T[K]
}

type Optional<T> = {
  [K in keyof T]?: T[K]
}

interface User {
  name: string
  age: number
  email: string
}

type ReadonlyUser = Readonly<User>
type OptionalUser = Optional<User>

Wizualizacja iteruje przez każdy klucz obiektu, pokazując jak K in keyof T przechodzi przez "name", "age", "email" i jaką transformację stosuje.

Infer keyword

infer to prawdopodobnie najtrudniejszy do zrozumienia element TypeScript. Visual Types robi tu największą różnicę - zamiast abstrakcyjnego opisu, widzisz jak TypeScript "dopasowuje" wzorzec i wyciąga z niego typ:

Code
TypeScript
type ReturnType<T> = T extends (...args: any[]) => infer R ? R : never

type Fn = (x: number) => string
type Result = ReturnType<Fn>  // string

Wizualizacja pokazuje jak TypeScript dopasowuje (x: number) => string do wzorca (...args: any[]) => infer R, "odkrywając" że R = string.

Distributive conditional types

Jedne z najbardziej zaskakujących zachowań w TypeScript:

Code
TypeScript
type ToArray<T> = T extends any ? T[] : never

type Result = ToArray<string | number>
// string[] | number[]  (nie (string | number)[]!)

Visual Types wizualizuje dystrybucję - jak union type jest rozkładany na poszczególne elementy, każdy przetwarzany osobno, a wyniki łączone z powrotem w union.

Template literal types

Manipulacja stringów na poziomie typów:

Code
TypeScript
type EventName<T extends string> = `on${Capitalize<T>}`

type ClickEvent = EventName<"click">     // "onClick"
type HoverEvent = EventName<"hover">     // "onHover"
type SubmitEvent = EventName<"submit">   // "onSubmit"

Recursive types

Typy rekurencyjne, które odwołują się same do siebie:

Code
TypeScript
type DeepReadonly<T> = {
  readonly [K in keyof T]: T[K] extends object
    ? DeepReadonly<T[K]>
    : T[K]
}

Visual Types pokazuje jak rekurencja "zagłębia się" w zagnieżdżone obiekty, stosując transformację na każdym poziomie.

Porównanie z innymi zasobami

CechaVisual TypesTypeScript docsType ChallengesTotal TypeScript
WizualizacjeTakNieNieCzęściowo
InteraktywnośćTakNieTak (edytor)Tak
AnimacjeTakNieNieNie
CenaDarmoweDarmoweDarmowePłatne
PoziomŚredni-zaawansowanyWszystkieZaawansowanyWszystkie
FormatLekcje wizualneDokumentacjaWyzwaniaKursy video

Kiedy wybrać Visual Types?

  • Rozumiesz podstawy TypeScript, ale typy zaawansowane są dla ciebie niejasne
  • Uczysz się wzrokowo i potrzebujesz "zobaczyć" jak coś działa
  • Chcesz zrozumieć jak TypeScript rozwiązuje typy krok po kroku
  • Preferujesz krótkie, skoncentrowane lekcje zamiast długich kursów

Kiedy sięgnąć po coś innego?

  • TypeScript docs - jeśli potrzebujesz kompletnej referencji
  • Type Challenges - jeśli chcesz ćwiczyć przez rozwiązywanie zadań
  • Total TypeScript - jeśli szukasz kompleksowego kursu od podstaw

Kim jest Kit Langton?

Kit Langton to programista i twórca narzędzi edukacyjnych, którego życiowym celem jest "przyspieszenie ery systemów efektów". Pracował z wieloma językami programowania - Haskell, Scala, Swift, TypeScript, Ruby, Rust - i jest znany z tworzenia interaktywnych wizualizacji dla abstrakcyjnych konceptów programistycznych.

Inne projekty Kit Langtona

  • Effect Institute - interaktywne lekcje dla biblioteki Effect
  • Visual Effect - wizualizator biblioteki Effect
  • Effect Solutions - przewodnik po idiomatycznym Effect
  • Hex - darmowa aplikacja macOS do zamiany mowy na tekst (718 gwiazdek na GitHubie)
  • A Macro Almanac - książka o metaprogramowaniu w Scali

Visual Types wpisuje się w filozofię Kit Langtona - abstrakcyjne koncepty najlepiej uczyć przez interaktywne doświadczenia wizualne.

Jak zacząć?

  1. Wejdź na types.kitlangton.com
  2. Wybierz lekcję, która cię interesuje
  3. Klikaj przez wizualizacje, czytaj wyjaśnienia
  4. Eksperymentuj ze zmianami parametrów
  5. Powtarzaj lekcje, których nie rozumiesz za pierwszym razem

Nie ma instalacji, konta ani rejestracji. Wszystko działa bezpośrednio w przeglądarce.

Praktyczne zastosowania wiedzy z Visual Types

Wiedza o zaawansowanych typach TypeScript ma bezpośrednie przełożenie na codzienną pracę:

Lepsze API bibliotek

Code
TypeScript
type EventMap = {
  click: MouseEvent
  keydown: KeyboardEvent
  scroll: Event
}

function on<K extends keyof EventMap>(
  event: K,
  handler: (e: EventMap[K]) => void
): void {
  document.addEventListener(event, handler as EventListener)
}

on("click", (e) => {
  console.log(e.clientX)
})

Type-safe builders

Code
TypeScript
type Builder<T extends Record<string, unknown>> = {
  set<K extends keyof T>(key: K, value: T[K]): Builder<T>
  build(): T
}

Walidacja na poziomie typów

Code
TypeScript
type PathParams<Path extends string> =
  Path extends `${string}:${infer Param}/${infer Rest}`
    ? Param | PathParams<Rest>
    : Path extends `${string}:${infer Param}`
    ? Param
    : never

type Params = PathParams<"/users/:id/posts/:postId">
// "id" | "postId"

FAQ

Czy Visual Types jest darmowe?

Tak, projekt jest w pełni darmowy i dostępny online.

Czy potrzebuję znać TypeScript, żeby zacząć?

Powinieneś znać podstawy TypeScript - typy proste, interfejsy, podstawowe generics. Visual Types skupia się na średnio-zaawansowanych i zaawansowanych aspektach systemu typów.

Czy mogę korzystać offline?

Visual Types to aplikacja webowa - potrzebujesz połączenia z internetem.

Czym Visual Types różni się od Type Challenges?

Type Challenges to zbiór zadań do samodzielnego rozwiązania. Visual Types to lekcje z wizualizacjami, które wyjaśniają jak typy działają. Oba narzędzia się uzupełniają - Visual Types do nauki, Type Challenges do praktyki.

Czy są planowane nowe lekcje?

Kit Langton aktywnie rozwija swoje projekty edukacyjne. Warto śledzić jego profil na X (@kitlangton) po aktualizacje.

Podsumowanie

Visual Types to unikalne narzędzie w ekosystemie TypeScript. Zamiast kolejnego kursu video czy dokumentacji, oferuje coś, czego nikt inny nie robi - interaktywne wizualizacje działania systemu typów. Jeśli kiedykolwiek zmagałeś się z generics, conditional types, mapped types czy infer, Visual Types może być tym narzędziem, które w końcu sprawi, że wszystko "kliknie".

Wejdź na types.kitlangton.com i przekonaj się sam. Żadnej instalacji, żadnej rejestracji - wystarczy przeglądarka i ciekawość.


Visual Types - Interactive TypeScript lessons with visualizations

Have you ever stared at a complex TypeScript type and felt like you were reading hieroglyphs? Omit<Pick<T, K extends keyof T>, "id"> - what does this actually do? How does data flow through conditional types? How does extends in generics differ from extends in interfaces?

Visual Types is a project by Kit Langton that solves this problem in the most elegant way possible - it shows you how TypeScript types work through interactive visualizations and animations. Instead of reading dry definitions, you watch in real time how the type system processes your code.

What is Visual Types?

Visual Types (available at types.kitlangton.com) is a collection of interactive lessons dedicated to the TypeScript type system. Each lesson combines visual animations with explanations, letting you see - literally - how TypeScript resolves types, performs inference, and applies transformations.

The project was created by Kit Langton - a developer known for his work with effect systems (Effect, Scala ZIO) and creating interactive educational tools. Visual Types is part of his broader philosophy: the best way to learn abstract programming concepts is to visualize them.

Why does type visualization matter?

TypeScript's type system is one of the most expressive among popular programming languages. But this expressiveness comes at a cost - complexity. When you start working with:

  • Generics - parametric types that take other types as arguments
  • Conditional types - T extends U ? X : Y - conditional logic at the type level
  • Mapped types - transformations of object keys and values
  • Template literal types - string manipulation at the type level
  • Infer - type extraction from patterns

...the traditional approach (reading documentation) quickly becomes insufficient. You need to see how these mechanisms work step by step.

How do the lessons work?

Interactive visualizations

Each lesson in Visual Types is not static text with code. It's an interactive animation that:

  1. Shows type flow - you see how TypeScript resolves a type step by step
  2. Visualizes transformations - you watch how mapped types transform an object
  3. Animates inference - you observe how infer extracts types from patterns
  4. Allows experimentation - you can modify parameters and observe the results

Narration and context

The lessons don't throw you into the deep end. Each concept is introduced gradually, with natural language explanations before moving to visualizations. This approach makes even advanced topics like recursive conditional types understandable.

Key topics

Type system fundamentals

Visual Types starts with the foundations - how TypeScript understands types, what type narrowing is, how structural typing works. These basics are crucial because all advanced concepts build upon them.

Code
TypeScript
type IsString<T> = T extends string ? true : false

type A = IsString<"hello">  // true
type B = IsString<42>        // false

Instead of guessing what extends does in a type context, Visual Types visually shows how TypeScript compares the type "hello" with string and why the result is true.

Generics

Generics are one of the most important concepts in TypeScript. Visual Types visualizes them as "slots" into which you place concrete types:

Code
TypeScript
type Box<T> = {
  value: T
  isEmpty: boolean
}

type StringBox = Box<string>
// { value: string; isEmpty: boolean }

type NumberBox = Box<number>
// { value: number; isEmpty: boolean }

The visualization shows how T is replaced by a concrete type everywhere it appears - not as an abstract substitution, but as an animated flow.

Conditional types

Conditional types are a powerful tool, but nesting them can be hard to follow:

Code
TypeScript
type TypeName<T> =
  T extends string ? "string" :
  T extends number ? "number" :
  T extends boolean ? "boolean" :
  T extends undefined ? "undefined" :
  "object"

type T0 = TypeName<string>   // "string"
type T1 = TypeName<boolean>  // "boolean"
type T2 = TypeName<Date>     // "object"

Visual Types shows the evaluation path - which branch is selected and why, with the active branch highlighted.

Mapped types

Mapped types let you transform object shapes:

Code
TypeScript
type Readonly<T> = {
  readonly [K in keyof T]: T[K]
}

type Optional<T> = {
  [K in keyof T]?: T[K]
}

interface User {
  name: string
  age: number
  email: string
}

type ReadonlyUser = Readonly<User>
type OptionalUser = Optional<User>

The visualization iterates through each object key, showing how K in keyof T goes through "name", "age", "email" and what transformation it applies.

The infer keyword

infer is probably the hardest element to understand in TypeScript. Visual Types makes the biggest difference here - instead of an abstract description, you see how TypeScript "matches" a pattern and extracts a type from it:

Code
TypeScript
type ReturnType<T> = T extends (...args: any[]) => infer R ? R : never

type Fn = (x: number) => string
type Result = ReturnType<Fn>  // string

The visualization shows how TypeScript matches (x: number) => string to the pattern (...args: any[]) => infer R, "discovering" that R = string.

Distributive conditional types

One of the most surprising behaviors in TypeScript:

Code
TypeScript
type ToArray<T> = T extends any ? T[] : never

type Result = ToArray<string | number>
// string[] | number[]  (not (string | number)[]!)

Visual Types visualizes distribution - how a union type is decomposed into individual elements, each processed separately, and the results combined back into a union.

Template literal types

String manipulation at the type level:

Code
TypeScript
type EventName<T extends string> = `on${Capitalize<T>}`

type ClickEvent = EventName<"click">     // "onClick"
type HoverEvent = EventName<"hover">     // "onHover"
type SubmitEvent = EventName<"submit">   // "onSubmit"

Recursive types

Recursive types that reference themselves:

Code
TypeScript
type DeepReadonly<T> = {
  readonly [K in keyof T]: T[K] extends object
    ? DeepReadonly<T[K]>
    : T[K]
}

Visual Types shows how recursion "dives" into nested objects, applying the transformation at each level.

Comparison with other resources

FeatureVisual TypesTypeScript docsType ChallengesTotal TypeScript
VisualizationsYesNoNoPartially
InteractivityYesNoYes (editor)Yes
AnimationsYesNoNoNo
PriceFreeFreeFreePaid
LevelIntermediate-advancedAllAdvancedAll
FormatVisual lessonsDocumentationChallengesVideo courses

When to choose Visual Types?

  • You understand TypeScript basics, but advanced types are unclear to you
  • You're a visual learner and need to "see" how things work
  • You want to understand how TypeScript resolves types step by step
  • You prefer short, focused lessons instead of lengthy courses

When to reach for something else?

  • TypeScript docs - if you need a complete reference
  • Type Challenges - if you want to practice by solving problems
  • Total TypeScript - if you're looking for a comprehensive course from scratch

Who is Kit Langton?

Kit Langton is a developer and educational tool creator whose life goal is to "precipitate the age of effect systems." He has worked with many programming languages - Haskell, Scala, Swift, TypeScript, Ruby, Rust - and is known for creating interactive visualizations for abstract programming concepts.

Other projects by Kit Langton

  • Effect Institute - interactive lessons for the Effect library
  • Visual Effect - Effect library visualizer
  • Effect Solutions - guide to idiomatic Effect
  • Hex - free macOS speech-to-text app (718 GitHub stars)
  • A Macro Almanac - a book on metaprogramming in Scala

Visual Types fits into Kit Langton's philosophy - abstract concepts are best taught through interactive visual experiences.

How to get started?

  1. Go to types.kitlangton.com
  2. Choose a lesson that interests you
  3. Click through the visualizations, read the explanations
  4. Experiment with parameter changes
  5. Repeat lessons you don't understand the first time

No installation, no account, no registration. Everything works directly in the browser.

Practical applications of Visual Types knowledge

Knowledge of advanced TypeScript types has a direct impact on everyday work:

Better library APIs

Code
TypeScript
type EventMap = {
  click: MouseEvent
  keydown: KeyboardEvent
  scroll: Event
}

function on<K extends keyof EventMap>(
  event: K,
  handler: (e: EventMap[K]) => void
): void {
  document.addEventListener(event, handler as EventListener)
}

on("click", (e) => {
  console.log(e.clientX)
})

Type-safe builders

Code
TypeScript
type Builder<T extends Record<string, unknown>> = {
  set<K extends keyof T>(key: K, value: T[K]): Builder<T>
  build(): T
}

Type-level validation

Code
TypeScript
type PathParams<Path extends string> =
  Path extends `${string}:${infer Param}/${infer Rest}`
    ? Param | PathParams<Rest>
    : Path extends `${string}:${infer Param}`
    ? Param
    : never

type Params = PathParams<"/users/:id/posts/:postId">
// "id" | "postId"

FAQ

Is Visual Types free?

Yes, the project is completely free and available online.

Do I need to know TypeScript to get started?

You should know the basics of TypeScript - primitive types, interfaces, basic generics. Visual Types focuses on intermediate and advanced aspects of the type system.

Can I use it offline?

Visual Types is a web application - you need an internet connection.

How does Visual Types differ from Type Challenges?

Type Challenges is a collection of problems to solve on your own. Visual Types consists of lessons with visualizations that explain how types work. Both tools complement each other - Visual Types for learning, Type Challenges for practice.

Are new lessons planned?

Kit Langton actively develops his educational projects. Follow his X profile (@kitlangton) for updates.

Summary

Visual Types is a unique tool in the TypeScript ecosystem. Instead of another video course or documentation, it offers something nobody else does - interactive visualizations of how the type system works. If you've ever struggled with generics, conditional types, mapped types, or infer, Visual Types might be the tool that finally makes everything "click."

Visit types.kitlangton.com and see for yourself. No installation, no registration - just a browser and curiosity.