Concept
unknown is the safe any: a value of unknown type that you must check before using. It is the right type for parsed JSON, caught errors and any input from outside the program.
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 The unknown type doing its job.
function message(error: unknown): string {
if (error instanceof Error) return error.message;
if (typeof error === "string") return error;
return "Unknown error";
}
try {
JSON.parse("{bad json");
} catch (error) { // error: unknown under useUnknownInCatchVariables
console.error(message(error));
}Reaching for any because unknown "gets in the way". any switches checking off for everything it touches; unknown makes you narrow once, at the boundary, and the rest stays typed.
Your roadmap puts these before The unknown type, unless you already know them.
Once a session shows you understand The unknown type, 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 The unknown type.