When you don't know the type
Data from the internet or a user could be anything. TypeScript has two types for "I don't know": any turns checking off, while unknown keeps you safe by making you check first.
any vs unknown
let a: any = "hello";
a.toFixed(2);
let u: unknown = "hello";
u.toUpperCase();
if (typeof u === "string") {
console.log(u.toUpperCase());
}Treat any as a last resort. Reach for unknown and check — your future self will thank you.