I’m not a TypeScript dev so I apologize for the stupid question. Is there any functional difference between the two? I.e. is there a case where using Unknown instead of Any will result in some sort of “compile” time error opposed to a runtime?
Some of that happens "automatically" at this point in the large number of ways that types can now be narrowed implicitly in Typescript (type guards [library functions], type asserts, the `typeof` runtime operator, the `in` runtime operator [as of recently], etc), so it can feel like `unknown`/`any` are the same up to a point, that point being where the runtime type is trivially known based on if statements and library functions around your use of the type.
(Fun fact: `any` predates most type narrowing and `unknown` by several major Typescript versions. So `any` beyond just being the final "escape hatch" from type checking is also something of a legacy tool.)
https://www.typescriptlang.org/play?#code/GYVwdgxgLglg9mABAd...
let danger: any;
// These all compile:
danger(), 9 / danger, danger.access, danger.map(x => x \* 2)
let safe: unknown;
// These all explode in TS:
safe(), 9 / safe, safe.access, safe.map(x => x \* 2)