Concept
A literal type is one exact value: "GET", 404, true. A union of literals is the lightest way to express a fixed set of options, and the compiler catches every typo.
The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.
A few lines that show Literal types doing its job.
type Method = "GET" | "POST" | "DELETE";
function send(method: Method, url: string) { /* ... */ }
send("GET", "/users");
send("get", "/users"); // error: '"get"' is not assignable to 'Method'
const config = { method: "POST" } as const; // method: "POST", not string
send(config.method, "/users");Building an options object with let or without as const, then passing it on. The property widens to string, and the call to the function expecting the literal union fails.
Your roadmap puts these before Literal types, unless you already know them.
Once a session shows you understand Literal types, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.
Topics that build on Literal types.