Explore Library
TypeScriptAdvanced Types

44 items

1

Broken Mutable Mapped Type

Code Quiz
2

Distributive Conditional Types Over Unions

Quiz
3

Advanced Types: Unions to Mapped Types

Slides / Video
4

Conditional Types & Distribution

Flashcard
5

Narrowing, Utility Types & Type Guards

Slides / Video
6

Narrowing, Utility Types & Type Guards

Flashcard
7

Union, Intersection & Utility Types

Slides / Video
8

Union, Intersection & Utility Types

Flashcard
9

Higher-Order Type Manipulation Basics

Flashcard
10

unique symbol Type

Flashcard
11

Type Compatibility and Assignability

Flashcard
12

Branded/Nominal Types

Flashcard
13

typeof Type Operator

Flashcard
14

Variance (Covariance/Contravariance)

Flashcard
15

The satisfies Operator

Flashcard
16

Type Widening and Narrowing

Flashcard
17

Structural Typing

Flashcard
18

Function Overloads

Flashcard
19

Remapping Keys With as

Code Quiz
20

Variance: Covariance and Contravariance

Slides / Video
21

Mapped Types

Slides / Video
22

The infer Keyword Explained

Slides / Video
23

Conditional Types

Slides / Video
24

Indexed Access Types

Slides / Video
25

The keyof Type Operator

Slides / Video
26

The typeof Type Operator

Slides / Video
27

User-Defined Type Guards

Slides / Video
28

Type Guards and Narrowing

Slides / Video
29

Discriminated Unions

Slides / Video
30

Type Aliases in TypeScript

Slides / Video
31

Literal Types in TypeScript

Slides / Video
32

Intersection Types in TypeScript

Slides / Video
33

Union Types in TypeScript

Slides / Video
34

Branded Types via Intersection

Slides / Video
35

const Assertions in TypeScript

Slides / Video
36

Assertion Functions

Slides / Video
37

The unknown Type and Safe Narrowing

Slides / Video
38

The never Type in Advanced Contexts

Slides / Video
39

Distributive Conditional Types

Slides / Video
40

Recursive Types in TypeScript

Slides / Video
41

Advanced Utility Types

Slides / Video
42

TypeScript Utility Types Essentials

Slides / Video
43

Template Literal Types

Slides / Video
44

Key Remapping with as Clause

Slides / Video
Code Quiz

Broken Mutable Mapped Type

A mapped type meant to strip readonly actually keeps it — spot the missing modifier.

Codetypescript
type Mutable<T> = {
  readonly [P in keyof T]: T[P];
};

interface Config {
  readonly host: string;
  readonly port: number;
}

const c: Mutable<Config> = { host: "localhost", port: 8080 };
c.port = 9090; // intended to be allowed

The `Mutable<T>` type is supposed to make all properties writable, but assigning to `c.port` still errors. What is the bug?